4.9.326-rc1 review
Greg Kroah-Hartman
maintainercover 4.9.326-rc1 review
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.326-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.9.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.9.326-rc1
Nathan Chancellor <[email protected]>
MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
Zheyu Ma <[email protected]>
video: fbdev: i740fb: Check the argument of i740_calc_vclk()
Zhouyi Zhou <[email protected]>
powerpc/64: Init jump labels before parse_early_param()
Takashi Iwai <[email protected]>
ALSA: timer: Use deferred fasync helper
Takashi Iwai <[email protected]>
ALSA: core: Add async signal helpers
Liang He <[email protected]>
mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
Schspa Shi <[email protected]>
vfio: Clear the caps->buf to NULL after free
Liang He <[email protected]>
tty: serial: Fix refcount leak bug in ucc_uart.c
Kiselev, Oleg <[email protected]>
ext4: avoid resizing to a partial cluster size
Ye Bin <[email protected]>
ext4: avoid remove directory when directory is corrupted
Wentao_Liang <[email protected]>
drivers:md:fix a potential use-after-free bug
Christophe JAILLET <[email protected]>
cxl: Fix a memory leak in an error handling path
Jozef Martiniak <[email protected]>
gadgetfs: ep_io - wait until IRQ finishes
Liang He <[email protected]>
usb: host: ohci-ppc-of: Fix refcount leak bug
Sai Prakash Ranjan <[email protected]>
irqchip/tegra: Fix overflow implicit truncation warnings
Masahiro Yamada <[email protected]>
kbuild: clear LDFLAGS in the top Makefile
Csókás Bence <[email protected]>
fec: Fix timer capture timing in fec_ptp_enable_pps()
Pablo Neira Ayuso <[email protected]>
netfilter: nf_tables: really skip inactive sets when allocating name
Al Viro <[email protected]>
nios2: add force_successful_syscall_return()
Al Viro <[email protected]>
nios2: restarts apply only to the first sigframe we build...
Al Viro <[email protected]>
nios2: fix syscall restart checks
Al Viro <[email protected]>
nios2: traced syscall does need to check the syscall number
Al Viro <[email protected]>
nios2: don't leave NULLs in sys_call_table[]
Al Viro <[email protected]>
nios2: page fault et.al. are *not* restartable syscalls...
Duoming Zhou <[email protected]>
atm: idt77252: fix use-after-free bugs caused by tst_timer
Dan Carpenter <[email protected]>
xen/xenbus: fix return type in xenbus_file_read()
Peilin Ye <[email protected]>
vsock: Fix memory leak in vsock_connect()
Nikita Travkin <[email protected]>
pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
Miaoqian Lin <[email protected]>
pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
Trond Myklebust <[email protected]>
SUNRPC: Reinitialise the backchannel request buffers before reuse
Zhang Xianwei <[email protected]>
NFSv4.1: RECLAIM_COMPLETE must handle EACCES
Marc Kleine-Budde <[email protected]>
can: ems_usb: fix clang's -Wunaligned-access warning
Filipe Manana <[email protected]>
btrfs: fix lost error handling when looking up extended ref on log replay
Damien Le Moal <[email protected]>
ata: libata-eh: Add missing command name
Mikulas Patocka <[email protected]>
rds: add missing barrier to release_refill
Amadeusz Sławiński <[email protected]>
ALSA: info: Fix llseek return value when using callback
Jamal Hadi Salim <[email protected]>
net_sched: cls_route: disallow handle of 0
Tyler Hicks <[email protected]>
net/9p: Initialize the iounit field during fid creation
Guenter Roeck <[email protected]>
nios2: time: Read timer in get_cycles only if initialized
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression
Jose Alonso <[email protected]>
Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP"
Tony Battersby <[email protected]>
scsi: sg: Allow waiting for commands to complete on removed device
Eric Dumazet <[email protected]>
tcp: fix over estimation in sk_forced_mem_schedule()
Qu Wenruo <[email protected]>
btrfs: reject log replay if there is unsupported RO compat flag
Thadeu Lima de Souza Cascardo <[email protected]>
net_sched: cls_route: remove from list when handle is 0
Mikulas Patocka <[email protected]>
dm raid: fix address sanitizer warning in raid_status
Baokun Li <[email protected]>
ext4: correct max_inline_xattr_value_size computing
Eric Whitney <[email protected]>
ext4: fix extent status tree race in writeback error recovery path
Theodore Ts'o <[email protected]>
ext4: update s_overhead_clusters in the superblock during an on-line resize
Baokun Li <[email protected]>
ext4: fix use-after-free in ext4_xattr_set_entry
Lukas Czerner <[email protected]>
ext4: make sure ext4_append() always allocates new block
Baokun Li <[email protected]>
ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h
David Collins <[email protected]>
spmi: trace: fix stack-out-of-bound access in SPMI tracing functions
Alexander Lobakin <[email protected]>
x86/olpc: fix 'logical not is only applied to the left hand side'
Steffen Maier <[email protected]>
scsi: zfcp: Fix missing auto port scan and thus missing target ports
Florian Westphal <[email protected]>
netfilter: nf_tables: fix null deref due to zeroed list head
Weitao Wang <[email protected]>
USB: HCD: Fix URB giveback issue in tasklet function
Huacai Chen <[email protected]>
MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
Michael Ellerman <[email protected]>
powerpc/powernv: Avoid crashing if rng is NULL
Pali Rohár <[email protected]>
powerpc/fsl-pci: Fix Class Code of PCIe Root Port
Pali Rohár <[email protected]>
PCI: Add defines for normal and subtractive PCI bridges
Alexander Lobakin <[email protected]>
ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr()
Mikulas Patocka <[email protected]>
md-raid10: fix KASAN warning
Miklos Szeredi <[email protected]>
fuse: limit nsec
Daniel Borkmann <[email protected]>
bpf: fix overflow in prog accounting
Timur Tabi <[email protected]>
drm/nouveau: fix another off-by-one in nvbios_addr
Helge Deller <[email protected]>
parisc: Fix device names in /proc/iomem
Lukas Wunner <[email protected]>
usbnet: Fix linkwatch use-after-free on disconnect
David Howells <[email protected]>
vfs: Check the truncate maximum size in inode_newsize_ok()
Allen Ballway <[email protected]>
ALSA: hda/cirrus - support for iMac 12,1 model
Meng Tang <[email protected]>
ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model
Sean Christopherson <[email protected]>
KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks
Maciej S. Szmigiero <[email protected]>
KVM: SVM: Don't BUG if userspace injects an interrupt with GIF=0
Mikulas Patocka <[email protected]>
add barriers to buffer_uptodate and set_buffer_uptodate
Zheyu Ma <[email protected]>
ALSA: bcd2000: Fix a UAF bug on the error path of probing
Nick Desaulniers <[email protected]>
x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments
Nick Desaulniers <[email protected]>
Makefile: link with -z noexecstack --no-warn-rwx-segments
Ning Qiang <[email protected]>
macintosh/adb: fix oob read in do_adb_query() function
Hans-Christian Noren Egtvedt <[email protected]>
random: only call boot_init_stack_canary() once
Werner Sembach <[email protected]>
ACPI: video: Shortening quirk list by identifying Clevo by board_name only
Werner Sembach <[email protected]>
ACPI: video: Force backlight native for some TongFang devices
Daniel Micay <[email protected]>
init/main.c: extract early boot entropy from the passed cmdline
Laura Abbott <[email protected]>
init: move stack canary initialization after setup_arch
Viresh Kumar <[email protected]>
init/main: properly align the multi-line comment
Viresh Kumar <[email protected]>
init/main: Fix double "the" in comment
Christian Borntraeger <[email protected]>
include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap
Paul Moore <[email protected]>
selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
Tianyue Ren <[email protected]>
selinux: fix error initialization in inode_doinit_with_dentry()
Andreas Gruenbacher <[email protected]>
selinux: Convert isec->lock into a spinlock
Andreas Gruenbacher <[email protected]>
selinux: Clean up initialization of isec->sclass
Andreas Gruenbacher <[email protected]>
proc: Pass file mode to proc_pid_make_inode
Andreas Gruenbacher <[email protected]>
selinux: Minor cleanups
Nathan Chancellor <[email protected]>
ion: Make user_ion_handle_put_nolock() a void function
Wei Mingzhi <[email protected]>
mt7601u: add USB device ID for some versions of XiaoDu WiFi Dongle.
Greg Kroah-Hartman <[email protected]>
ARM: crypto: comment out gcc warning that breaks clang builds
Florian Westphal <[email protected]>
netfilter: nf_queue: do not allow packet truncation below transport header offset
Liang He <[email protected]>
net: sungem_phy: Add of_node_put() for reference returned by of_get_parent()
Kuniyuki Iwashima <[email protected]>
net: ping6: Fix memleak in ipv6_renew_options().
Liang He <[email protected]>
scsi: ufs: host: Hold reference returned by of_parse_phandle()
ChenXiaoSong <[email protected]>
ntfs: fix use-after-free in ntfs_ucsncmp()
Luiz Augusto von Dentz <[email protected]>
Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put
-------------
Diffstat:
Makefile | 8 +- arch/arm/lib/xor-neon.c | 3 +- arch/ia64/include/asm/processor.h | 2 +- arch/mips/cavium-octeon/octeon-platform.c | 3 +- arch/mips/kernel/proc.c | 2 +- arch/mips/mm/tlbex.c | 4 +- arch/nios2/include/asm/entry.h | 3 +- arch/nios2/include/asm/ptrace.h | 2 + arch/nios2/kernel/entry.S | 22 +++-- arch/nios2/kernel/signal.c | 3 +- arch/nios2/kernel/syscall_table.c | 1 + arch/nios2/kernel/time.c | 5 +- arch/parisc/kernel/drivers.c | 9 +- arch/powerpc/kernel/prom.c | 7 ++ arch/powerpc/platforms/powernv/rng.c | 2 + arch/powerpc/sysdev/fsl_pci.c | 8 ++ arch/powerpc/sysdev/fsl_pci.h | 1 + arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 + arch/x86/entry/vdso/Makefile | 2 +- arch/x86/kvm/emulate.c | 19 ++-- arch/x86/kvm/svm.c | 2 - arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- drivers/acpi/video_detect.c | 55 +++++++---- drivers/ata/libata-eh.c | 1 + drivers/atm/idt77252.c | 1 + drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- drivers/irqchip/irq-tegra.c | 10 +- drivers/macintosh/adb.c | 2 +- drivers/md/dm-raid.c | 2 +- drivers/md/raid10.c | 5 +- drivers/md/raid5.c | 2 +- drivers/misc/cxl/irq.c | 1 + drivers/net/can/usb/ems_usb.c | 2 +- drivers/net/ethernet/freescale/fec_ptp.c | 6 +- drivers/net/sungem_phy.c | 1 + drivers/net/usb/ax88179_178a.c | 14 +-- drivers/net/usb/usbnet.c | 8 +- drivers/net/wireless/mediatek/mt7601u/usb.c | 1 + drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 +- drivers/s390/scsi/zfcp_fc.c | 29 ++++-- drivers/s390/scsi/zfcp_fc.h | 6 +- drivers/s390/scsi/zfcp_fsf.c | 4 +- drivers/scsi/sg.c | 57 ++++++----- drivers/scsi/ufs/ufshcd-pltfrm.c | 15 ++- drivers/staging/android/ion/ion-ioctl.c | 8 +- drivers/tty/serial/ucc_uart.c | 2 + drivers/usb/core/hcd.c | 26 ++--- drivers/usb/gadget/legacy/inode.c | 1 + drivers/usb/host/ohci-ppc-of.c | 1 + drivers/vfio/vfio.c | 1 + drivers/video/fbdev/i740fb.c | 9 +- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 +- fs/attr.c | 2 + fs/btrfs/disk-io.c | 14 +++ fs/btrfs/tree-log.c | 4 +- fs/ext4/inline.c | 3 + fs/ext4/inode.c | 7 ++ fs/ext4/namei.c | 23 ++++- fs/ext4/resize.c | 11 +++ fs/ext4/xattr.c | 6 +- fs/ext4/xattr.h | 13 +++ fs/fuse/inode.c | 6 ++ fs/nfs/nfs4proc.c | 3 + fs/ntfs/attrib.c | 8 +- fs/proc/base.c | 23 ++--- fs/proc/fd.c | 6 +- fs/proc/internal.h | 2 +- fs/proc/namespaces.c | 3 +- include/linux/bpf.h | 11 +++ include/linux/buffer_head.h | 25 ++++- include/linux/pci_ids.h | 2 + include/linux/usb/hcd.h | 1 + include/net/bluetooth/l2cap.h | 1 + include/sound/core.h | 8 ++ include/trace/events/spmi.h | 12 +-- include/uapi/linux/swab.h | 4 +- init/main.c | 14 +-- kernel/bpf/core.c | 16 ++- kernel/bpf/syscall.c | 36 +++++-- net/9p/client.c | 4 +- net/bluetooth/l2cap_core.c | 68 +++++++++---- net/ipv4/tcp_output.c | 7 +- net/ipv6/ping.c | 6 ++ net/netfilter/nf_tables_api.c | 3 +- net/netfilter/nfnetlink_queue.c | 7 +- net/rds/ib_recv.c | 1 + net/sched/cls_route.c | 8 +- net/sunrpc/backchannel_rqst.c | 14 +++ net/vmw_vsock/af_vsock.c | 9 +- security/selinux/hooks.c | 123 +++++++++++++++--------- security/selinux/include/objsec.h | 5 +- security/selinux/selinuxfs.c | 4 +- sound/core/info.c | 6 +- sound/core/misc.c | 94 ++++++++++++++++++ sound/core/timer.c | 11 ++- sound/pci/hda/patch_cirrus.c | 1 + sound/pci/hda/patch_conexant.c | 11 ++- sound/usb/bcd2000/bcd2000.c | 3 +- 100 files changed, 753 insertions(+), 296 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/101 Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put
From: Luiz Augusto von Dentz <[email protected]>
commit d0be8347c623e0ac4202a1d4e0373882821f56b0 upstream.
This fixes the following trace which is caused by hci_rx_work starting up *after* the final channel reference has been put() during sock_close() but *before* the references to the channel have been destroyed, so instead the code now rely on kref_get_unless_zero/l2cap_chan_hold_unless_zero to prevent referencing a channel that is about to be destroyed.
refcount_t: increment on 0; use-after-free.
BUG: KASAN: use-after-free in refcount_dec_and_test+0x20/0xd0 Read of size 4 at addr ffffffc114f5bf18 by task kworker/u17:14/705 CPU: 4 PID: 705 Comm: kworker/u17:14 Tainted: G S W 4.14.234-00003-g1fb6d0bd49a4-dirty #28 Hardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM sm8150 Flame DVT (DT) Workqueue: hci0 hci_rx_work Call trace: dump_backtrace+0x0/0x378 show_stack+0x20/0x2c dump_stack+0x124/0x148 print_address_description+0x80/0x2e8 __kasan_report+0x168/0x188 kasan_report+0x10/0x18 __asan_load4+0x84/0x8c refcount_dec_and_test+0x20/0xd0 l2cap_chan_put+0x48/0x12c l2cap_recv_frame+0x4770/0x6550 l2cap_recv_acldata+0x44c/0x7a4 hci_acldata_packet+0x100/0x188 hci_rx_work+0x178/0x23c process_one_work+0x35c/0x95c worker_thread+0x4cc/0x960 kthread+0x1a8/0x1c4 ret_from_fork+0x10/0x18
--- include/net/bluetooth/l2cap.h | 1 net/bluetooth/l2cap_core.c | 61 +++++++++++++++++++++++++++++++++--------- 2 files changed, 49 insertions(+), 13 deletions(-)
include/net/bluetooth/l2cap.h +1 -0
@@ -798,6 +798,7 @@ enum { };void l2cap_chan_hold (struct l2cap_chan *c); +struct l2cap_chan *l2cap_chan_hold_unless_zero (struct l2cap_chan *c);void l2cap_chan_put (struct l2cap_chan *c);static inline void l2cap_chan_lock (struct l2cap_chan *chan)
net/bluetooth/l2cap_core.c +48 -13
180 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 2/101 ntfs: fix use-after-free in ntfs_ucsncmp()
In reply to Greg Kroah-HartmanFrom: ChenXiaoSong <[email protected]>
commit 38c9c22a85aeed28d0831f230136e9cf6fa2ed44 upstream.
Syzkaller reported use-after-free bug as follows:
==================================================================
BUG: KASAN: use-after-free in ntfs_ucsncmp+0x123/0x130
Read of size 2 at addr ffff8880751acee8 by task a.out/879
CPU: 7 PID: 879 Comm: a.out Not tainted 5.19.0-rc4-next-20220630-00001-gcc5218c8bd2c-dirty #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.16.0-0-gd239552ce722-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x1c0/0x2b0
print_address_description.constprop.0.cold+0xd4/0x484
print_report.cold+0x55/0x232
kasan_report+0xbf/0xf0
ntfs_ucsncmp+0x123/0x130
ntfs_are_names_equal.cold+0x2b/0x41
ntfs_attr_find+0x43b/0xb90
ntfs_attr_lookup+0x16d/0x1e0
ntfs_read_locked_attr_inode+0x4aa/0x2360
ntfs_attr_iget+0x1af/0x220
ntfs_read_locked_inode+0x246c/0x5120
ntfs_iget+0x132/0x180
load_system_files+0x1cc6/0x3480
ntfs_fill_super+0xa66/0x1cf0
mount_bdev+0x38d/0x460
legacy_get_tree+0x10d/0x220
vfs_get_tree+0x93/0x300
do_new_mount+0x2da/0x6d0
path_mount+0x496/0x19d0
__x64_sys_mount+0x284/0x300
do_syscall_64+0x3b/0xc0
entry_SYSCALL_64_after_hwframe+0x46/0xb0
RIP: 0033:0x7f3f2118d9ea
Code: 48 8b 0d a9 f4 0b 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 76 f4 0b 00 f7 d8 64 89 01 48
RSP: 002b:00007ffc269deac8 EFLAGS: 00000202 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f3f2118d9ea
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc269dec00
RBP: 00007ffc269dec80 R08: 00007ffc269deb00 R09: 00007ffc269dec44
R10: 0000000000000000 R11: 0000000000000202 R12: 000055f81ab1d220
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
</TASK>
The buggy address belongs to the physical page:
page:0000000085430378 refcount:1 mapcount:1 mapping:0000000000000000 index:0x555c6a81d pfn:0x751ac
memcg:ffff888101f7e180
anon flags: 0xfffffc00a0014(uptodate|lru|mappedtodisk|swapbacked|node=0|zone=1|lastcpupid=0x1fffff)
raw: 000fffffc00a0014 ffffea0001bf2988 ffffea0001de2448 ffff88801712e201
raw: 0000000555c6a81d 0000000000000000 0000000100000000 ffff888101f7e180
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8880751acd80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880751ace00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880751ace80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
^
ffff8880751acf00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8880751acf80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================The reason is that struct ATTR_RECORD->name_offset is 6485, end address of name string is out of bounds.
Fix this by adding sanity check on end address of attribute name string.
--- fs/ntfs/attrib.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/ntfs/attrib.c +6 -2
@@ -606,8 +606,12 @@ static int ntfs_attr_find(const ATTR_TYP a = (ATTR_RECORD *)((u8 *)ctx->attr +le32_to_cpu (ctx->attr->length));for (;; a = (ATTR_RECORD *)((u8 *)a +le32_to_cpu (a->length))) { -if ((u8 *)a < (u8 *)ctx->mrec || (u8 *)a > (u8 *)ctx->mrec + -le32_to_cpu (ctx->mrec->bytes_allocated)) +u8 *mrec_end = (u8 *)ctx->mrec + +le32_to_cpu (ctx->mrec->bytes_allocated); +u8 *name_end = (u8 *)a +le16_to_cpu (a->name_offset) + + a->name_length *sizeof (ntfschar); +if ((u8 *)a < (u8 *)ctx->mrec || (u8 *)a > mrec_end || + name_end > mrec_end)break ; ctx->attr = a; if (unlikely(le32_to_cpu(a->type) > le32_to_cpu(type) ||
Greg Kroah-Hartman
maintainerPATCH 3/101 scsi: ufs: host: Hold reference returned by of_parse_phandle()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
commit a3435afba87dc6cd83f5595e7607f3c40f93ef01 upstream.
In ufshcd_populate_vreg(), we should hold the reference returned by of_parse_phandle() and then use it to call of_node_put() for refcount balance.
--- drivers/scsi/ufs/ufshcd-pltfrm.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/scsi/ufs/ufshcd-pltfrm.c +13 -2
@@ -126,9 +126,20 @@ out:return ret; } +static bool phandle_exists (const struct device_node *np, +const char *phandle_name,int index) +{ +struct device_node *parse_np =of_parse_phandle (np, phandle_name, index); + +if (parse_np) +of_node_put (parse_np); + +return parse_np !=NULL ; +} +#define MAX_PROP_SIZE 32static int ufshcd_populate_vreg (struct device *dev,const char *name, -struct ufs_vreg **out_vreg) +struct ufs_vreg **out_vreg) {int ret =0 ;char prop_name[MAX_PROP_SIZE ];
@@ -141,7 +152,7 @@ static int ufshcd_populate_vreg(struct d }snprintf (prop_name,MAX_PROP_SIZE ,"%s-supply" , name); -if (!of_parse_phandle (np, prop_name,0 )) { +if (!phandle_exists (np, prop_name,0 )) {dev_info (dev,"%s: Unable to find %s regulator, assuming enabled\n" , __func__, prop_name); goto out;
Greg Kroah-Hartman
maintainerPATCH 4/101 net: ping6: Fix memleak in ipv6_renew_options().
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
commit e27326009a3d247b831eda38878c777f6f4eb3d1 upstream.
When we close ping6 sockets, some resources are left unfreed because pingv6_prot is missing sk->sk_prot->destroy(). As reported by syzbot [0], just three syscalls leak 96 bytes and easily cause OOM.
struct ipv6_sr_hdr *hdr;
char data[24] = {0};
int fd;
hdr = (struct ipv6_sr_hdr *)data;
hdr->hdrlen = 2;
hdr->type = IPV6_SRCRT_TYPE_4;
fd = socket(AF_INET6, SOCK_DGRAM, NEXTHDR_ICMP);
setsockopt(fd, IPPROTO_IPV6, IPV6_RTHDR, data, 24);
close(fd);To fix memory leaks, let's add a destroy function.
Note the socket() syscall checks if the GID is within the range of net.ipv4.ping_group_range. The default value is [1, 0] so that no GID meets the condition (1 <= GID <= 0). Thus, the local DoS does not succeed until we change the default value. However, at least Ubuntu/Fedora/RHEL loosen it.
$ cat /usr/lib/sysctl.d/50-default.conf
...
-net.ipv4.ping_group_range = 0 2147483647Also, there could be another path reported with these options, and some of them require CAP_NET_RAW.
setsockopt
IPV6_ADDRFORM (inet6_sk(sk)->pktoptions)
IPV6_RECVPATHMTU (inet6_sk(sk)->rxpmtu)
IPV6_HOPOPTS (inet6_sk(sk)->opt)
IPV6_RTHDRDSTOPTS (inet6_sk(sk)->opt)
IPV6_RTHDR (inet6_sk(sk)->opt)
IPV6_DSTOPTS (inet6_sk(sk)->opt)
IPV6_2292PKTOPTIONS (inet6_sk(sk)->opt)getsockopt
IPV6_FLOWLABEL_MGR (inet6_sk(sk)->ipv6_fl_list)
For the record, I left a different splat with syzbot's one.
unreferenced object 0xffff888006270c60 (size 96):
comm "repro2", pid 231, jiffies 4294696626 (age 13.118s)
hex dump (first 32 bytes):
01 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 ....D...........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<00000000f6bc7ea9>] sock_kmalloc (net/core/sock.c:2564 net/core/sock.c:2554)
[<000000006d699550>] do_ipv6_setsockopt.constprop.0 (net/ipv6/ipv6_sockglue.c:715)
[<00000000c3c3b1f5>] ipv6_setsockopt (net/ipv6/ipv6_sockglue.c:1024)
[<000000007096a025>] __sys_setsockopt (net/socket.c:2254)
[<000000003a8ff47b>] __x64_sys_setsockopt (net/socket.c:2265 net/socket.c:2262 net/socket.c:2262)
[<000000007c409dcb>] do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80)
[<00000000e939c4a9>] entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:120)[0]: https://syzkaller.appspot.com/bug?extid=a8430774139ec3ab7176
--- net/ipv6/ping.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/ipv6/ping.c +6 -0
@@ -26,6 +26,11 @@#include <net/transp_v6.h> #include <net/ping.h> +static void ping_v6_destroy (struct sock *sk) +{ +inet6_destroy_sock (sk); +} +/* Compatibility glue so we can support IPv6 when it's compiled as a module */ static int dummy_ipv6_recv_error (struct sock *sk,struct msghdr *msg,int len,int *addr_len)
@@ -179,6 +184,7 @@ struct proto pingv6_prot = { .owner = THIS_MODULE, .init = ping_init_sock, .close = ping_close, + .destroy = ping_v6_destroy, .connect = ip6_datagram_connect_v6_only, .disconnect = __udp_disconnect, .setsockopt = ipv6_setsockopt,
Greg Kroah-Hartman
maintainerPATCH 5/101 net: sungem_phy: Add of_node_put() for reference returned by of_get_parent()
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit ebbbe23fdf6070e31509638df3321688358cc211 ]
In bcm5421_init(), we should call of_node_put() for the reference returned by of_get_parent() which has increased the refcount.
--- drivers/net/sungem_phy.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/sungem_phy.c +1 -0
@@ -453,6 +453,7 @@ static int bcm5421_init(struct mii_phy* phy)int can_low_power =1 ;if (np ==NULL ||of_get_property (np,"no-autolowpower" ,NULL )) can_low_power =0 ; +of_node_put (np);if (can_low_power) {/* Enable automatic low-power */ sungem_phy_write (phy,0x1c ,0x9002 );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 6/101 netfilter: nf_queue: do not allow packet truncation below transport header offset
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
[ Upstream commit 99a63d36cb3ed5ca3aa6fcb64cffbeaf3b0fb164 ]
Domingo Dirutigliano and Nicola Guerrera report kernel panic when sending nf_queue verdict with 1-byte nfta_payload attribute.
The IP/IPv6 stack pulls the IP(v6) header from the packet after the input hook.
If user truncates the packet below the header size, this skb_pull() will result in a malformed skb (skb->len < 0).
--- net/netfilter/nfnetlink_queue.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/netfilter/nfnetlink_queue.c +6 -1
@@ -807,11 +807,16 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) }static int -nfqnl_mangle (void *data,int data_len,struct nf_queue_entry *e,int diff) +nfqnl_mangle (void *data,unsigned int data_len,struct nf_queue_entry *e,int diff) {struct sk_buff *nskb;if (diff <0 ) { +unsigned int min_len =skb_transport_offset (e->skb); + +if (data_len < min_len) +return -EINVAL ; +if (pskb_trim (e->skb, data_len))return -ENOMEM ; }else if (diff >0 ) {
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 7/101 ARM: crypto: comment out gcc warning that breaks clang builds
In reply to Greg Kroah-HartmanFrom: Greg Kroah-Hartman <[email protected]>
The gcc build warning prevents all clang-built kernels from working properly, so comment it out to fix the build.
This is a -stable kernel only patch for now, it will be resolved differently in mainline releases in the future.
--- arch/arm/lib/xor-neon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm/lib/xor-neon.c +2 -1
@@ -29,8 +29,9 @@ MODULE_LICENSE("GPL");* While older versions of GCC do not generate incorrect code, they fail to * recognize the parallel nature of these functions, and emit plain ARM code, * which is known to be slower than the optimized ARM code in asm-arm/xor.h. +* +* #warning This code requires at least version 4.6 of GCC */ -#warning This code requires at least version 4.6 of GCC#endif #pragma GCC diagnostic ignored "-Wunused-variable"
Greg Kroah-Hartman
maintainerPATCH 8/101 mt7601u: add USB device ID for some versions of XiaoDu WiFi Dongle.
In reply to Greg Kroah-HartmanFrom: Wei Mingzhi <[email protected]>
commit 829eea7c94e0bac804e65975639a2f2e5f147033 upstream.
USB device ID of some versions of XiaoDu WiFi Dongle is 2955:1003 instead of 2955:1001. Both are the same mt7601u hardware.
--- drivers/net/wireless/mediatek/mt7601u/usb.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/mediatek/mt7601u/usb.c +1 -0
@@ -34,6 +34,7 @@ static struct usb_device_id mt7601u_devi { USB_DEVICE(0x2717, 0x4106) }, { USB_DEVICE(0x2955, 0x0001) }, { USB_DEVICE(0x2955, 0x1001) }, + { USB_DEVICE(0x2955, 0x1003) }, { USB_DEVICE(0x2a5f, 0x1000) }, { USB_DEVICE(0x7392, 0x7710) }, { 0, }
Greg Kroah-Hartman
maintainerPATCH 9/101 ion: Make user_ion_handle_put_nolock() a void function
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
Clang warns:
drivers/staging/android/ion/ion-ioctl.c:71:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized]
if (--handle->user_ref_count == 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/android/ion/ion-ioctl.c:74:9: note: uninitialized use occurs here
return ret;
^~~
drivers/staging/android/ion/ion-ioctl.c:71:2: note: remove the 'if' if its condition is always true
if (--handle->user_ref_count == 0)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/staging/android/ion/ion-ioctl.c:69:9: note: initialize the variable 'ret' to silence this warning
int ret;
^
= 01 warning generated.
The return value of user_ion_handle_put_nolock() is not checked in its one call site in user_ion_free_nolock() so just make user_ion_handle_put_nolock() return void to remove the warning.
--- drivers/staging/android/ion/ion-ioctl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/staging/android/ion/ion-ioctl.c +2 -6
@@ -64,14 +64,10 @@ static struct ion_handle *pass_to_user(s }/* Must hold the client lock */ -static int user_ion_handle_put_nolock (struct ion_handle *handle) +static void user_ion_handle_put_nolock (struct ion_handle *handle) { -int ret; -if (--handle->user_ref_count ==0 ) - ret =ion_handle_put_nolock (handle); - -return ret; +ion_handle_put_nolock (handle); } static void user_ion_free_nolock(struct ion_client *client,
Greg Kroah-Hartman
maintainerPATCH 10/101 selinux: Minor cleanups
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 420591128cb206201dc444c2d42fb6f299b2ecd0 upstream.
Fix the comment for function __inode_security_revalidate, which returns an integer.
Use the LABEL_* constants consistently for isec->initialized.
--- security/selinux/hooks.c | 3 ++- security/selinux/selinuxfs.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
security/selinux/hooks.c +2 -1
@@ -237,6 +237,7 @@ static int inode_alloc_security(struct i isec->sid =SECINITSID_UNLABELED ; isec->sclass =SECCLASS_FILE ; isec->task_sid = sid; + isec->initialized =LABEL_INVALID ; inode->i_security = isec;return 0 ;
@@ -247,7 +248,7 @@ static int inode_doinit_with_dentry(stru/* * Try reloading inode security labels that have been marked as invalid. The * @may_sleep parameter indicates when sleeping and thus reloading labels is -* allowed; when set to false, returns ERR_PTR(-ECHILD) when the label is +* allowed; when set to false, returns -ECHILD when the label is * invalid. The @opt_dentry parameter should be set to a dentry of the inode; * when no dentry is available, set it to NULL instead. */
security/selinux/selinuxfs.c +2 -2
@@ -1301,7 +1301,7 @@ static int sel_make_bools(void) goto out; isec->sid = sid; - isec->initialized =1 ; + isec->initialized =LABEL_INITIALIZED ; inode->i_fop = &sel_bool_ops; inode->i_ino = i|SEL_BOOL_INO_OFFSET ;d_add (dentry, inode);
@@ -1835,7 +1835,7 @@ static int sel_fill_super(struct super_b isec = (struct inode_security_struct *)inode->i_security; isec->sid =SECINITSID_DEVNULL ; isec->sclass =SECCLASS_CHR_FILE ; - isec->initialized =1 ; + isec->initialized =LABEL_INITIALIZED ;init_special_inode (inode,S_IFCHR |S_IRUGO |S_IWUGO ,MKDEV (MEM_MAJOR ,3 ));d_add (dentry, inode);
Greg Kroah-Hartman
maintainerPATCH 11/101 proc: Pass file mode to proc_pid_make_inode
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit db978da8fa1d0819b210c137d31a339149b88875 upstream.
Pass the file mode of the proc inode to be created to proc_pid_make_inode. In proc_pid_make_inode, initialize inode->i_mode before calling security_task_to_inode. This allows selinux to set isec->sclass right away without introducing "half-initialized" inode security structs.
--- fs/proc/base.c | 23 +++++++++-------------- fs/proc/fd.c | 6 ++---- fs/proc/internal.h | 2 +- fs/proc/namespaces.c | 3 +-- security/selinux/hooks.c | 1 + 5 files changed, 14 insertions(+), 21 deletions(-)
fs/proc/base.c +9 -14
@@ -1676,7 +1676,8 @@ const struct inode_operations proc_pid_l/* building an inode */ -struct inode *proc_pid_make_inode (struct super_block * sb,struct task_struct *task) +struct inode *proc_pid_make_inode (struct super_block * sb, +struct task_struct *task,umode_t mode) {struct inode * inode;struct proc_inode *ei;
@@ -1690,6 +1691,7 @@ struct inode *proc_pid_make_inode(struct/* Common stuff */ ei =PROC_I (inode); + inode->i_mode = mode; inode->i_ino =get_next_ino (); inode->i_mtime = inode->i_atime = inode->i_ctime =current_time (inode); inode->i_op = &proc_def_inode_operations;
@@ -2041,7 +2043,9 @@ proc_map_files_instantiate(struct inodestruct proc_inode *ei;struct inode *inode; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFLNK | + ((mode &FMODE_READ ) ?S_IRUSR :0 ) | + ((mode &FMODE_WRITE ) ?S_IWUSR :0 ));if (!inode)return -ENOENT ;
@@ -2050,12 +2054,6 @@ proc_map_files_instantiate(struct inode inode->i_op = &proc_map_files_link_inode_operations; inode->i_size =64 ; - inode->i_mode =S_IFLNK ; - -if (mode &FMODE_READ ) - inode->i_mode |=S_IRUSR ; -if (mode &FMODE_WRITE ) - inode->i_mode |=S_IWUSR ;d_set_d_op (dentry, &tid_map_files_dentry_operations);d_add (dentry, inode);
@@ -2409,12 +2407,11 @@ static int proc_pident_instantiate(strucstruct inode *inode;struct proc_inode *ei; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task, p->mode);if (!inode) goto out; ei =PROC_I (inode); - inode->i_mode = p->mode;if (S_ISDIR (inode->i_mode))set_nlink (inode,2 );/* Use getattr to fix if necessary */ if (p->iop)
@@ -3109,11 +3106,10 @@ static int proc_pid_instantiate(struct i {struct inode *inode; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFDIR |S_IRUGO |S_IXUGO );if (!inode) goto out; - inode->i_mode =S_IFDIR |S_IRUGO |S_IXUGO ; inode->i_op = &proc_tgid_base_inode_operations; inode->i_fop = &proc_tgid_base_operations; inode->i_flags|=S_IMMUTABLE ;
@@ -3404,11 +3400,10 @@ static int proc_task_instantiate(struct struct dentry *dentry, struct task_struct *task, const void *ptr) { struct inode *inode; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFDIR |S_IRUGO |S_IXUGO );if (!inode) goto out; - inode->i_mode =S_IFDIR |S_IRUGO |S_IXUGO ; inode->i_op = &proc_tid_base_inode_operations; inode->i_fop = &proc_tid_base_operations; inode->i_flags|=S_IMMUTABLE ;
fs/proc/fd.c +2 -4
@@ -183,14 +183,13 @@ proc_fd_instantiate(struct inode *dir, sstruct proc_inode *ei;struct inode *inode; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFLNK );if (!inode) goto out; ei =PROC_I (inode); ei->fd = fd; - inode->i_mode =S_IFLNK ; inode->i_op = &proc_pid_link_inode_operations; inode->i_size =64 ;
@@ -322,14 +321,13 @@ proc_fdinfo_instantiate(struct inode *distruct proc_inode *ei;struct inode *inode; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFREG |S_IRUSR );if (!inode) goto out; ei =PROC_I (inode); ei->fd = fd; - inode->i_mode =S_IFREG |S_IRUSR ; inode->i_fop = &proc_fdinfo_file_operations;d_set_d_op (dentry, &tid_fd_dentry_operations);
fs/proc/internal.h +1 -1
@@ -163,7 +163,7 @@ extern int proc_pid_statm(struct seq_filextern const struct dentry_operations pid_dentry_operations;extern int pid_getattr (struct vfsmount *,struct dentry *,struct kstat *);extern int proc_setattr (struct dentry *,struct iattr *); -extern struct inode *proc_pid_make_inode (struct super_block *,struct task_struct *); +extern struct inode *proc_pid_make_inode (struct super_block *,struct task_struct *,umode_t );extern int pid_revalidate (struct dentry *,unsigned int );extern int pid_delete_dentry (const struct dentry *);extern int proc_pid_readdir (struct file *,struct dir_context *);
fs/proc/namespaces.c +1 -2
@@ -92,12 +92,11 @@ static int proc_ns_instantiate(struct instruct inode *inode;struct proc_inode *ei; - inode =proc_pid_make_inode (dir->i_sb, task); + inode =proc_pid_make_inode (dir->i_sb, task,S_IFLNK |S_IRWXUGO );if (!inode) goto out; ei =PROC_I (inode); - inode->i_mode =S_IFLNK |S_IRWXUGO ; inode->i_op = &proc_ns_link_inode_operations; ei->ns_ops = ns_ops;
security/selinux/hooks.c +1 -0
@@ -3958,6 +3958,7 @@ static void selinux_task_to_inode(structstruct inode_security_struct *isec = inode->i_security;u32 sid =task_sid (p); + isec->sclass =inode_mode_to_security_class (inode->i_mode); isec->sid = sid; isec->initialized =LABEL_INITIALIZED ; }
Greg Kroah-Hartman
maintainerPATCH 12/101 selinux: Clean up initialization of isec->sclass
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 13457d073c29da92001f6ee809075eaa8757fb96 upstream.
Now that isec->initialized == LABEL_INITIALIZED implies that isec->sclass is valid, skip such inodes immediately in inode_doinit_with_dentry.
For the remaining inodes, initialize isec->sclass at the beginning of inode_doinit_with_dentry to simplify the code.
--- security/selinux/hooks.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
security/selinux/hooks.c +4 -6
@@ -1395,12 +1395,15 @@ static int inode_doinit_with_dentry(struint rc =0 ;if (isec->initialized ==LABEL_INITIALIZED ) - goto out; +return 0 ;mutex_lock (&isec->lock);if (isec->initialized ==LABEL_INITIALIZED ) goto out_unlock; +if (isec->sclass ==SECCLASS_FILE ) + isec->sclass =inode_mode_to_security_class (inode->i_mode); + sbsec = inode->i_sb->s_security;if (!(sbsec->flags &SE_SBINITIALIZED )) {/* Defer initialization until selinux_complete_init,
@@ -1518,7 +1521,6 @@ static int inode_doinit_with_dentry(stru isec->sid = sbsec->sid;/* Try to obtain a transition SID. */ - isec->sclass =inode_mode_to_security_class (inode->i_mode); rc =security_transition_sid (isec->task_sid, sbsec->sid, isec->sclass,NULL , &sid);if (rc)
@@ -1554,7 +1556,6 @@ static int inode_doinit_with_dentry(stru*/ if (!dentry) goto out_unlock; - isec->sclass =inode_mode_to_security_class (inode->i_mode); rc =selinux_genfs_get_sid (dentry, isec->sclass, sbsec->flags, &sid);dput (dentry);
@@ -1569,9 +1570,6 @@ static int inode_doinit_with_dentry(stru out_unlock:mutex_unlock (&isec->lock); -out: -if (isec->sclass ==SECCLASS_FILE ) - isec->sclass =inode_mode_to_security_class (inode->i_mode);return rc; }
Greg Kroah-Hartman
maintainerPATCH 13/101 selinux: Convert isec->lock into a spinlock
In reply to Greg Kroah-HartmanFrom: Andreas Gruenbacher <[email protected]>
commit 9287aed2ad1ff1bde5eb190bcd6dccd5f1cf47d3 upstream.
Convert isec->lock from a mutex into a spinlock. Instead of holding the lock while sleeping in inode_doinit_with_dentry, set isec->initialized to LABEL_PENDING and release the lock. Then, when the sid has been determined, re-acquire the lock. If isec->initialized is still set to LABEL_PENDING, set isec->sid; otherwise, the sid has been set by another task (LABEL_INITIALIZED) or invalidated (LABEL_INVALID) in the meantime.
This fixes a deadlock on gfs2 where
* one task is in inode_doinit_with_dentry -> gfs2_getxattr, holds isec->lock, and tries to acquire the inode's glock, and
* another task is in do_xmote -> inode_go_inval -> selinux_inode_invalidate_secctx, holds the inode's glock, and tries to acquire isec->lock.
--- security/selinux/hooks.c | 101 +++++++++++++++++++++++--------------- security/selinux/include/objsec.h | 5 + 2 files changed, 66 insertions(+), 40 deletions(-)
security/selinux/hooks.c +63 -38
@@ -231,7 +231,7 @@ static int inode_alloc_security(struct iif (!isec)return -ENOMEM ; -mutex_init (&isec->lock); +spin_lock_init (&isec->lock);INIT_LIST_HEAD (&isec->list); isec->inode = inode; isec->sid =SECINITSID_UNLABELED ;
@@ -1387,7 +1387,8 @@ static int inode_doinit_with_dentry(stru {struct superblock_security_struct *sbsec =NULL ;struct inode_security_struct *isec = inode->i_security; -u32 sid; +u32 task_sid, sid =0 ; +u16 sclass;struct dentry *dentry;#define INITCONTEXTLEN 255char *context =NULL ;
@@ -1397,7 +1398,7 @@ static int inode_doinit_with_dentry(struif (isec->initialized ==LABEL_INITIALIZED )return 0 ; -mutex_lock (&isec->lock); +spin_lock (&isec->lock);if (isec->initialized ==LABEL_INITIALIZED ) goto out_unlock;
@@ -1416,12 +1417,18 @@ static int inode_doinit_with_dentry(stru goto out_unlock; } + sclass = isec->sclass; + task_sid = isec->task_sid; + sid = isec->sid; + isec->initialized =LABEL_PENDING ; +spin_unlock (&isec->lock); +switch (sbsec->behavior) {case SECURITY_FS_USE_NATIVE :break ;case SECURITY_FS_USE_XATTR :if (!(inode->i_opflags &IOP_XATTR )) { - isec->sid = sbsec->def_sid; + sid = sbsec->def_sid;break ; }/* Need a dentry, since the xattr API requires one.
@@ -1443,7 +1450,7 @@ static int inode_doinit_with_dentry(stru* inode_doinit with a dentry, before these inodes could * be used again by userspace. */ - goto out_unlock; + goto out; } len =INITCONTEXTLEN ;
@@ -1451,7 +1458,7 @@ static int inode_doinit_with_dentry(struif (!context) { rc = -ENOMEM ;dput (dentry); - goto out_unlock; + goto out; } context[len] ='\0' ; rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX , context, len);
@@ -1462,14 +1469,14 @@ static int inode_doinit_with_dentry(stru rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX ,NULL ,0 );if (rc <0 ) {dput (dentry); - goto out_unlock; + goto out; } len = rc; context =kmalloc (len+1 ,GFP_NOFS );if (!context) { rc = -ENOMEM ;dput (dentry); - goto out_unlock; + goto out; } context[len] ='\0' ; rc =__vfs_getxattr (dentry, inode,XATTR_NAME_SELINUX , context, len);
@@ -1481,7 +1488,7 @@ static int inode_doinit_with_dentry(stru"%d for dev=%s ino=%ld\n" , __func__, -rc, inode->i_sb->s_id, inode->i_ino);kfree (context); - goto out_unlock; + goto out; }/* Map ENODATA to the default file SID */ sid = sbsec->def_sid;
@@ -1511,28 +1518,25 @@ static int inode_doinit_with_dentry(stru } }kfree (context); - isec->sid = sid;break ;case SECURITY_FS_USE_TASK : - isec->sid = isec->task_sid; + sid = task_sid;break ;case SECURITY_FS_USE_TRANS :/* Default to the fs SID. */ - isec->sid = sbsec->sid; + sid = sbsec->sid;/* Try to obtain a transition SID. */ - rc =security_transition_sid (isec->task_sid, sbsec->sid, - isec->sclass,NULL , &sid); + rc =security_transition_sid (task_sid, sid, sclass,NULL , &sid);if (rc) - goto out_unlock; - isec->sid = sid; + goto out;break ;case SECURITY_FS_USE_MNTPOINT : - isec->sid = sbsec->mntpoint_sid; + sid = sbsec->mntpoint_sid;break ;default :/* Default to the fs superblock SID. */ - isec->sid = sbsec->sid; + sid = sbsec->sid;if ((sbsec->flags &SE_SBGENFS ) && !S_ISLNK (inode->i_mode)) {/* We must have a dentry to determine the label on
@@ -1555,21 +1559,30 @@ static int inode_doinit_with_dentry(stru* could be used again by userspace. */ if (!dentry) - goto out_unlock; - rc =selinux_genfs_get_sid (dentry, isec->sclass, + goto out; + rc =selinux_genfs_get_sid (dentry, sclass, sbsec->flags, &sid);dput (dentry);if (rc) - goto out_unlock; - isec->sid = sid; + goto out; }break ; } - isec->initialized =LABEL_INITIALIZED ; +out: +spin_lock (&isec->lock); +if (isec->initialized ==LABEL_PENDING ) { +if (!sid || rc) { + isec->initialized =LABEL_INVALID ; + goto out_unlock; + } + + isec->initialized =LABEL_INITIALIZED ; + isec->sid = sid; + } out_unlock: -mutex_unlock (&isec->lock); +spin_unlock (&isec->lock);return rc; }
@@ -3199,9 +3212,11 @@ static void selinux_inode_post_setxattr( } isec =backing_inode_security (dentry); +spin_lock (&isec->lock); isec->sclass =inode_mode_to_security_class (inode->i_mode); isec->sid = newsid; isec->initialized =LABEL_INITIALIZED ; +spin_unlock (&isec->lock);return ; }
@@ -3298,9 +3313,11 @@ static int selinux_inode_setsecurity(strif (rc)return rc; +spin_lock (&isec->lock); isec->sclass =inode_mode_to_security_class (inode->i_mode); isec->sid = newsid; isec->initialized =LABEL_INITIALIZED ; +spin_unlock (&isec->lock);return 0 ; }
@@ -3956,9 +3973,11 @@ static void selinux_task_to_inode(structstruct inode_security_struct *isec = inode->i_security;u32 sid =task_sid (p); +spin_lock (&isec->lock); isec->sclass =inode_mode_to_security_class (inode->i_mode); isec->sid = sid; isec->initialized =LABEL_INITIALIZED ; +spin_unlock (&isec->lock); }/* Returns error only if unable to parse addresses */
@@ -4277,24 +4296,24 @@ static int selinux_socket_post_create(stconst struct task_security_struct *tsec =current_security ();struct inode_security_struct *isec =inode_security_novalidate (SOCK_INODE (sock));struct sk_security_struct *sksec; +u16 sclass =socket_type_to_security_class (family, type, protocol); +u32 sid =SECINITSID_KERNEL ;int err =0 ; - isec->sclass =socket_type_to_security_class (family, type, protocol); - -if (kern) - isec->sid =SECINITSID_KERNEL ; -else { - err =socket_sockcreate_sid (tsec, isec->sclass, &(isec->sid)); +if (!kern) { + err =socket_sockcreate_sid (tsec, sclass, &sid);if (err)return err; } + isec->sclass = sclass; + isec->sid = sid; isec->initialized =LABEL_INITIALIZED ;if (sock->sk) { sksec = sock->sk->sk_security; - sksec->sid = isec->sid; - sksec->sclass = isec->sclass; + sksec->sclass = sclass; + sksec->sid = sid; err =selinux_netlbl_socket_post_create (sock->sk, family); }
@@ -4478,16 +4497,22 @@ static int selinux_socket_accept(structint err;struct inode_security_struct *isec;struct inode_security_struct *newisec; +u16 sclass; +u32 sid; err =sock_has_perm (current, sock->sk,SOCKET__ACCEPT );if (err)return err; - newisec =inode_security_novalidate (SOCK_INODE (newsock)); - isec =inode_security_novalidate (SOCK_INODE (sock)); - newisec->sclass = isec->sclass; - newisec->sid = isec->sid; +spin_lock (&isec->lock); + sclass = isec->sclass; + sid = isec->sid; +spin_unlock (&isec->lock); + + newisec =inode_security_novalidate (SOCK_INODE (newsock)); + newisec->sclass = sclass; + newisec->sid = sid; newisec->initialized =LABEL_INITIALIZED ;return 0 ;
@@ -6010,9 +6035,9 @@ static void selinux_inode_invalidate_sec {struct inode_security_struct *isec = inode->i_security; -mutex_lock (&isec->lock); +spin_lock (&isec->lock); isec->initialized =LABEL_INVALID ; -mutex_unlock (&isec->lock); +spin_unlock (&isec->lock); }/*
security/selinux/include/objsec.h +3 -2
@@ -39,7 +39,8 @@ struct task_security_struct {enum label_initialized {LABEL_INVALID ,/* invalid or not initialized */ -LABEL_INITIALIZED /* initialized */ +LABEL_INITIALIZED ,/* initialized */ +LABEL_PENDING };struct inode_security_struct {
@@ -52,7 +53,7 @@ struct inode_security_struct {u32 sid;/* SID of this object */ u16 sclass;/* security class of this object */ unsigned char initialized;/* initialization flag */ -struct mutex lock; +spinlock_t lock; };struct file_security_struct {
Greg Kroah-Hartman
maintainerPATCH 14/101 selinux: fix error initialization in inode_doinit_with_dentry()
In reply to Greg Kroah-HartmanFrom: Tianyue Ren <[email protected]>
commit 83370b31a915493231e5b9addc72e4bef69f8d31 upstream.
Mark the inode security label as invalid if we cannot find a dentry so that we will retry later rather than marking it initialized with the unlabeled SID.
--- security/selinux/hooks.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
security/selinux/hooks.c +16 -3
@@ -1450,7 +1450,13 @@ static int inode_doinit_with_dentry(stru* inode_doinit with a dentry, before these inodes could * be used again by userspace. */ - goto out; + isec->initialized =LABEL_INVALID ; +/* +* There is nothing useful to jump to the "out" +* label, except a needless spin lock/unlock +* cycle. +*/ +return 0 ; } len =INITCONTEXTLEN ;
@@ -1558,8 +1564,15 @@ static int inode_doinit_with_dentry(stru* inode_doinit() with a dentry, before these inodes * could be used again by userspace. */ -if (!dentry) - goto out; +if (!dentry) { + isec->initialized =LABEL_INVALID ; +/* +* There is nothing useful to jump to the "out" +* label, except a needless spin lock/unlock +* cycle. +*/ +return 0 ; + } rc =selinux_genfs_get_sid (dentry, sclass, sbsec->flags, &sid);dput (dentry);
Greg Kroah-Hartman
maintainerPATCH 15/101 selinux: fix inode_doinit_with_dentry() LABEL_INVALID error handling
In reply to Greg Kroah-HartmanFrom: Paul Moore <[email protected]>
commit 200ea5a2292dc444a818b096ae6a32ba3caa51b9 upstream.
A previous fix, commit 83370b31a915 ("selinux: fix error initialization in inode_doinit_with_dentry()"), changed how failures were handled before a SELinux policy was loaded. Unfortunately that patch was potentially problematic for two reasons: it set the isec->initialized state without holding a lock, and it didn't set the inode's SELinux label to the "default" for the particular filesystem. The later can be a problem if/when a later attempt to revalidate the inode fails and SELinux reverts to the existing inode label.
This patch should restore the default inode labeling that existed before the original fix, without affecting the LABEL_INVALID marking such that revalidation will still be attempted in the future.
--- security/selinux/hooks.c | 31 +++++++++++++------------------ 1 file changed, 13 insertions(+), 18 deletions(-)
security/selinux/hooks.c +13 -18
@@ -1450,13 +1450,7 @@ static int inode_doinit_with_dentry(stru* inode_doinit with a dentry, before these inodes could * be used again by userspace. */ - isec->initialized =LABEL_INVALID ; -/* -* There is nothing useful to jump to the "out" -* label, except a needless spin lock/unlock -* cycle. -*/ -return 0 ; + goto out_invalid; } len =INITCONTEXTLEN ;
@@ -1564,15 +1558,8 @@ static int inode_doinit_with_dentry(stru* inode_doinit() with a dentry, before these inodes * could be used again by userspace. */ -if (!dentry) { - isec->initialized =LABEL_INVALID ; -/* -* There is nothing useful to jump to the "out" -* label, except a needless spin lock/unlock -* cycle. -*/ -return 0 ; - } +if (!dentry) + goto out_invalid; rc =selinux_genfs_get_sid (dentry, sclass, sbsec->flags, &sid);dput (dentry);
@@ -1585,11 +1572,10 @@ static int inode_doinit_with_dentry(stru out:spin_lock (&isec->lock);if (isec->initialized ==LABEL_PENDING ) { -if (!sid || rc) { +if (rc) { isec->initialized =LABEL_INVALID ; goto out_unlock; } - isec->initialized =LABEL_INITIALIZED ; isec->sid = sid; }
@@ -1597,6 +1583,15 @@ out: out_unlock:spin_unlock (&isec->lock);return rc; + +out_invalid: +spin_lock (&isec->lock); +if (isec->initialized ==LABEL_PENDING ) { + isec->initialized =LABEL_INVALID ; + isec->sid = sid; + } +spin_unlock (&isec->lock); +return 0 ; }/* Convert a Linux signal to an access vector. */
Greg Kroah-Hartman
maintainerPATCH 16/101 include/uapi/linux/swab.h: fix userspace breakage, use __BITS_PER_LONG for swap
In reply to Greg Kroah-HartmanFrom: Christian Borntraeger <[email protected]>
commit 467d12f5c7842896d2de3ced74e4147ee29e97c8 upstream.
QEMU has a funny new build error message when I use the upstream kernel headers:
CC block/file-posix.o
In file included from /home/cborntra/REPOS/qemu/include/qemu/timer.h:4,
from /home/cborntra/REPOS/qemu/include/qemu/timed-average.h:29,
from /home/cborntra/REPOS/qemu/include/block/accounting.h:28,
from /home/cborntra/REPOS/qemu/include/block/block_int.h:27,
from /home/cborntra/REPOS/qemu/block/file-posix.c:30:
/usr/include/linux/swab.h: In function `__swab':
/home/cborntra/REPOS/qemu/include/qemu/bitops.h:20:34: error: "sizeof" is not defined, evaluates to 0 [-Werror=undef]
20 | #define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE)
| ^~~~~~
/home/cborntra/REPOS/qemu/include/qemu/bitops.h:20:41: error: missing binary operator before token "("
20 | #define BITS_PER_LONG (sizeof (unsigned long) * BITS_PER_BYTE)
| ^
cc1: all warnings being treated as errors
make: *** [/home/cborntra/REPOS/qemu/rules.mak:69: block/file-posix.o] Error 1
rm tests/qemu-iotests/socket_scm_helper.o
This was triggered by commit d5767057c9a ("uapi: rename ext2_swab() to swab() and share globally in swab.h"). That patch is doing
#include <asm/bitsperlong.h>
but it uses BITS_PER_LONG.
The kernel file asm/bitsperlong.h provide only __BITS_PER_LONG.
Let us use the __ variant in swap.h
--- include/uapi/linux/swab.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
include/uapi/linux/swab.h +2 -2
@@ -134,9 +134,9 @@ static inline __attribute_const__ __u32static __always_inline unsigned long __swab (const unsigned long y) { -#if BITS_PER_LONG ==64 +#if __BITS_PER_LONG ==64 return __swab64 (y); -#else /* BITS_PER_LONG == 32 */ +#else /* __BITS_PER_LONG == 32 */ return __swab32 (y);#endif }
Greg Kroah-Hartman
maintainerPATCH 17/101 init/main: Fix double "the" in comment
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
commit 6623f1c6150c09ce946c8e27a4c814d64919495b upstream.
s/the\ the/the
--- init/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
init/main.c +1 -1
@@ -488,7 +488,7 @@ asmlinkage __visible void __init start_kdebug_objects_early_init ();/* -* Set up the the initial canary ASAP: +* Set up the initial canary ASAP: */ add_latent_entropy ();boot_init_stack_canary ();
Greg Kroah-Hartman
maintainerPATCH 18/101 init/main: properly align the multi-line comment
In reply to Greg Kroah-HartmanFrom: Viresh Kumar <[email protected]>
commit 1b3b3b49b9961401331a1b496db5bec5c7b41ae6 upstream.
Add a tab before it to follow standard practices. Also add the missing full stop '.'.
--- init/main.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
init/main.c +4 -4
@@ -498,10 +498,10 @@ asmlinkage __visible void __init start_klocal_irq_disable (); early_boot_irqs_disabled = true; -/* -* Interrupts are still disabled. Do necessary setups, then -* enable them -*/ +/* +* Interrupts are still disabled. Do necessary setups, then +* enable them. +*/ boot_cpu_init ();page_address_init ();pr_notice ("%s" , linux_banner);
Greg Kroah-Hartman
maintainerPATCH 19/101 init: move stack canary initialization after setup_arch
In reply to Greg Kroah-HartmanFrom: Laura Abbott <[email protected]>
commit 121388a31362b0d3176dc1190ac8064b98a61b20 upstream.
Patch series "Command line randomness", v3.
A series to add the kernel command line as a source of randomness.
This patch (of 2):
Stack canary intialization involves getting a random number. Getting this random number may involve accessing caches or other architectural specific features which are not available until after the architecture is setup. Move the stack canary initialization later to accommodate this.
--- init/main.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
init/main.c +5 -6
@@ -487,12 +487,6 @@ asmlinkage __visible void __init start_ksmp_setup_processor_id ();debug_objects_early_init (); -/* -* Set up the initial canary ASAP: -*/ -add_latent_entropy (); -boot_init_stack_canary (); -cgroup_init_early ();local_irq_disable ();
@@ -506,6 +500,11 @@ asmlinkage __visible void __init start_kpage_address_init ();pr_notice ("%s" , linux_banner);setup_arch (&command_line); +/* +* Set up the the initial canary and entropy after arch +*/ +add_latent_entropy (); +boot_init_stack_canary ();mm_init_cpumask (&init_mm);setup_command_line (command_line);setup_nr_cpu_ids ();
Greg Kroah-Hartman
maintainerPATCH 20/101 init/main.c: extract early boot entropy from the passed cmdline
In reply to Greg Kroah-HartmanFrom: Daniel Micay <[email protected]>
commit 33d72f3822d7ff8a9e45bd7413c811085cb87aa5 upstream.
Feed the boot command-line as to the /dev/random entropy pool
Existing Android bootloaders usually pass data which may not be known by an external attacker on the kernel command-line. It may also be the case on other embedded systems. Sample command-line from a Google Pixel running CopperheadOS....
console=ttyHSL0,115200,n8 androidboot.console=ttyHSL0
androidboot.hardware=sailfish user_debug=31 ehci-hcd.park=3
lpm_levels.sleep_disabled=1 cma=32M@0-0xffffffff buildvariant=user
veritykeyid=id:dfcb9db0089e5b3b4090a592415c28e1cb4545ab
androidboot.bootdevice=624000.ufshc androidboot.verifiedbootstate=yellow
androidboot.veritymode=enforcing androidboot.keymaster=1
androidboot.serialno=FA6CE0305299 androidboot.baseband=msm
mdss_mdp.panel=1:dsi:0:qcom,mdss_dsi_samsung_ea8064tg_1080p_cmd:1:none:cfg:single_dsi
androidboot.slot_suffix=_b fpsimd.fpsimd_settings=0
app_setting.use_app_setting=0 kernelflag=0x00000000 debugflag=0x00000000
androidboot.hardware.revision=PVT radioflag=0x00000000
radioflagex1=0x00000000 radioflagex2=0x00000000 cpumask=0x00000000
androidboot.hardware.ddr=4096MB,Hynix,LPDDR4 androidboot.ddrinfo=00000006
androidboot.ddrsize=4GB androidboot.hardware.color=GRA00
androidboot.hardware.ufs=32GB,Samsung androidboot.msm.hw_ver_id=268824801
androidboot.qf.st=2 androidboot.cid=11111111 androidboot.mid=G-2PW4100
androidboot.bootloader=8996-012001-1704121145
androidboot.oem_unlock_support=1 androidboot.fp_src=1
androidboot.htc.hrdump=detected androidboot.ramdump.opt=mem@2g:2g,mem@4g:2g
androidboot.bootreason=reboot androidboot.ramdump_enable=0 ro
root=/dev/dm-0 dm="system none ro,0 1 android-verity /dev/sda34"
rootwait skip_initramfs init=/init androidboot.wificountrycode=US
androidboot.boottime=1BLL:85,1BLE:669,2BLL:0,2BLE:1777,SW:6,KL:8136Among other things, it contains a value unique to the device (androidboot.serialno=FA6CE0305299), unique to the OS builds for the device variant (veritykeyid=id:dfcb9db0089e5b3b4090a592415c28e1cb4545ab) and timings from the bootloader stages in milliseconds (androidboot.boottime=1BLL:85,1BLE:669,2BLL:0,2BLE:1777,SW:6,KL:8136).
--- init/main.c | 2 ++ 1 file changed, 2 insertions(+)
init/main.c +2 -0
@@ -502,8 +502,10 @@ asmlinkage __visible void __init start_ksetup_arch (&command_line);/* * Set up the the initial canary and entropy after arch +* and after adding latent and command line entropy. */ add_latent_entropy (); +add_device_randomness (command_line,strlen (command_line));boot_init_stack_canary ();mm_init_cpumask (&init_mm);setup_command_line (command_line);
Greg Kroah-Hartman
maintainerPATCH 21/101 ACPI: video: Force backlight native for some TongFang devices
In reply to Greg Kroah-HartmanFrom: Werner Sembach <[email protected]>
commit c752089f7cf5b5800c6ace4cdd1a8351ee78a598 upstream.
The TongFang PF5PU1G, PF4NU1F, PF5NU1G, and PF5LUXG/TUXEDO BA15 Gen10, Pulse 14/15 Gen1, and Pulse 15 Gen2 have the same problem as the Clevo NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2:
They have a working native and video interface. However the default detection mechanism first registers the video interface before unregistering it again and switching to the native interface during boot. This results in a dangling SBIOS request for backlight change for some reason, causing the backlight to switch to ~2% once per boot on the first power cord connect or disconnect event. Setting the native interface explicitly circumvents this buggy behaviour by avoiding the unregistering process.
--- drivers/acpi/video_detect.c | 51 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-)
drivers/acpi/video_detect.c +50 -1
@@ -210,7 +210,56 @@ static const struct dmi_system_id video_ DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), }, }, - +/* +* The TongFang PF5PU1G, PF4NU1F, PF5NU1G, and PF5LUXG/TUXEDO BA15 Gen10, +* Pulse 14/15 Gen1, and Pulse 15 Gen2 have the same problem as the Clevo +* NL5xRU and NL5xNU/TUXEDO Aura 15 Gen1 and Gen2. See the description +* above. +*/ + { + .callback = video_detect_force_native, + .ident = "TongFang PF5PU1G", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5PU1G"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF4NU1F", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF4NU1F"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF4NU1F", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "PULSE1401"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5NU1G", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5NU1G"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5NU1G", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TUXEDO"), + DMI_MATCH(DMI_BOARD_NAME, "PULSE1501"), + }, + }, + { + .callback = video_detect_force_native, + .ident = "TongFang PF5LUXG", + .matches = { + DMI_MATCH(DMI_BOARD_NAME, "PF5LUXG"), + }, + }, /* * These models have a working acpi_video backlight control, and using * native backlight causes a regression where backlight does not work
Greg Kroah-Hartman
maintainerPATCH 22/101 ACPI: video: Shortening quirk list by identifying Clevo by board_name only
In reply to Greg Kroah-HartmanFrom: Werner Sembach <[email protected]>
commit f0341e67b3782603737f7788e71bd3530012a4f4 upstream.
Taking a recent change in the i8042 quirklist to this one: Clevo board_names are somewhat unique, and if not: The generic Board_-/Sys_Vendor string "Notebook" doesn't help much anyway. So identifying the devices just by the board_name helps keeping the list significantly shorter and might even hit more devices requiring the fix.
--- drivers/acpi/video_detect.c | 34 ---------------------------------- 1 file changed, 34 deletions(-)
drivers/acpi/video_detect.c +0 -34
@@ -150,23 +150,6 @@ static const struct dmi_system_id video_ .callback = video_detect_force_native, .ident = "Clevo NL5xRU", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xRU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xRU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Notebook" ), DMI_MATCH(DMI_BOARD_NAME, "NL5xRU"), }, },
@@ -190,23 +173,6 @@ static const struct dmi_system_id video_ .callback = video_detect_force_native, .ident = "Clevo NL5xNU", .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"TUXEDO" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xNU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"SchenkerTechnologiesGmbH" ), - DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), - }, - }, - { - .callback = video_detect_force_native, - .ident = "Clevo NL5xNU", - .matches = { -DMI_MATCH (DMI_SYS_VENDOR ,"Notebook" ), DMI_MATCH(DMI_BOARD_NAME, "NL5xNU"), }, },
Greg Kroah-Hartman
maintainerPATCH 23/101 random: only call boot_init_stack_canary() once
In reply to Greg Kroah-HartmanFrom: Hans-Christian Noren Egtvedt <[email protected]>
In commit 166a592cad36 ("random: move rand_initialize() earlier") the boot_init_stack_canary() call was added after the new random_init() call.
However, the upstream commit d55535232c3d ("random: move rand_initialize() earlier") also included removing the earlier call to boot_init_stack_canary(), making sure this call is done after random_init().
Hence fix what I assume is a wrong merge conflict resolution on the linux-4.9.y stable branch.
--- init/main.c | 7 ------- 1 file changed, 7 deletions(-)
init/main.c +0 -7
@@ -500,13 +500,6 @@ asmlinkage __visible void __init start_kpage_address_init ();pr_notice ("%s" , linux_banner);setup_arch (&command_line); -/* -* Set up the the initial canary and entropy after arch -* and after adding latent and command line entropy. -*/ -add_latent_entropy (); -add_device_randomness (command_line,strlen (command_line)); -boot_init_stack_canary ();mm_init_cpumask (&init_mm);setup_command_line (command_line);setup_nr_cpu_ids ();
Greg Kroah-Hartman
maintainerPATCH 24/101 macintosh/adb: fix oob read in do_adb_query() function
In reply to Greg Kroah-HartmanFrom: Ning Qiang <[email protected]>
commit fd97e4ad6d3b0c9fce3bca8ea8e6969d9ce7423b upstream.
In do_adb_query() function of drivers/macintosh/adb.c, req->data is copied form userland. The parameter "req->data[2]" is missing check, the array size of adb_handler[] is 16, so adb_handler[req->data[2]].original_address and adb_handler[req->data[2]].handler_id will lead to oob read.
--- drivers/macintosh/adb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/macintosh/adb.c +1 -1
@@ -650,7 +650,7 @@ do_adb_query(struct adb_request *req)switch (req->data[1 ]) {case ADB_QUERY_GETDEVINFO : -if (req->nbytes <3 ) +if (req->nbytes <3 || req->data[2 ] >=16 )break ;mutex_lock (&adb_handler_mutex); req->reply[0 ] = adb_handler[req->data[2 ]].original_address;
Greg Kroah-Hartman
maintainerPATCH 25/101 Makefile: link with -z noexecstack --no-warn-rwx-segments
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit 0d362be5b14200b77ecc2127936a5ff82fbffe41 upstream.
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form:
ld: warning: vmlinux: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: vmlinux has a LOAD segment with RWX permissions
Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack.
LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check.
While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments.
--- Makefile | 3 +++ 1 file changed, 3 insertions(+)
Makefile +3 -0
@@ -870,6 +870,9 @@ ifdef CONFIG_LD_DEAD_CODE_DATA_ELIMINATI LDFLAGS_vmlinux += $(call ld-option, --gc-sections,) endif +LDFLAGS += -z noexecstack +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) + ifeq ($(CONFIG_STRIP_ASM_SYMS),y) LDFLAGS_vmlinux += $(call ld-option, -X,) endif
Greg Kroah-Hartman
maintainerPATCH 26/101 x86: link vdso and boot with -z noexecstack --no-warn-rwx-segments
In reply to Greg Kroah-HartmanFrom: Nick Desaulniers <[email protected]>
commit ffcf9c5700e49c0aee42dcba9a12ba21338e8136 upstream.
Users of GNU ld (BFD) from binutils 2.39+ will observe multiple instances of a new warning when linking kernels in the form:
ld: warning: arch/x86/boot/pmjump.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ld: warning: arch/x86/boot/compressed/vmlinux has a LOAD segment with RWX permissions
Generally, we would like to avoid the stack being executable. Because there could be a need for the stack to be executable, assembler sources have to opt-in to this security feature via explicit creation of the .note.GNU-stack feature (which compilers create by default) or command line flag --noexecstack. Or we can simply tell the linker the production of such sections is irrelevant and to link the stack as --noexecstack.
LLVM's LLD linker defaults to -z noexecstack, so this flag isn't strictly necessary when linking with LLD, only BFD, but it doesn't hurt to be explicit here for all linkers IMO. --no-warn-rwx-segments is currently BFD specific and only available in the current latest release, so it's wrapped in an ld-option check.
While the kernel makes extensive usage of ELF sections, it doesn't use permissions from ELF segments.
--- arch/x86/boot/Makefile | 2 +- arch/x86/boot/compressed/Makefile | 4 ++++ arch/x86/entry/vdso/Makefile | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-)
arch/x86/boot/Makefile +1 -1
@@ -100,7 +100,7 @@ $(obj)/zoffset.h: $(obj)/compressed/vmli AFLAGS_header.o += -I$(objtree)/$(obj) $(obj)/header.o: $(obj)/zoffset.h -LDFLAGS_setup.elf := -m elf_i386 -T +LDFLAGS_setup.elf := -m elf_i386 -z noexecstack -T $(obj)/setup.elf: $(src)/setup.ld $(SETUP_OBJS) FORCE $(call if_changed,ld)
arch/x86/boot/compressed/Makefile +4 -0
@@ -54,6 +54,10 @@ else LDFLAGS += $(shell $(LD) --help 2>&1 | grep -q "\-z noreloc-overflow" \ && echo "-z noreloc-overflow -pie --no-dynamic-linker") endif + +LDFLAGS += -z noexecstack +LDFLAGS += $(call ld-option,--no-warn-rwx-segments) + LDFLAGS_vmlinux := -T hostprogs-y := mkpiggy
arch/x86/entry/vdso/Makefile +1 -1
@@ -168,7 +168,7 @@ quiet_cmd_vdso = VDSO $@ VDSO_LDFLAGS = -shared $(call ld-option, --hash-style=both) \ $(call ld-option, --build-id) $(call ld-option, --eh-frame-hdr) \ - -Bsymbolic + -Bsymbolic -z noexecstack GCOV_PROFILE := n #
Greg Kroah-Hartman
maintainerPATCH 27/101 ALSA: bcd2000: Fix a UAF bug on the error path of probing
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
commit ffb2759df7efbc00187bfd9d1072434a13a54139 upstream.
When the driver fails in snd_card_register() at probe time, it will free the 'bcd2k->midi_out_urb' before killing it, which may cause a UAF bug.
The following log can reveal it:
[ 50.727020] BUG: KASAN: use-after-free in bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000] [ 50.727623] Read of size 8 at addr ffff88810fab0e88 by task swapper/4/0 [ 50.729530] Call Trace: [ 50.732899] bcd2000_input_complete+0x1f1/0x2e0 [snd_bcd2000]
Fix this by adding usb_kill_urb() before usb_free_urb().
--- sound/usb/bcd2000/bcd2000.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/bcd2000/bcd2000.c +2 -1
@@ -350,7 +350,8 @@ static int bcd2000_init_midi(struct bcd2static void bcd2000_free_usb_related_resources (struct bcd2000 *bcd2k,struct usb_interface *interface) { -/* usb_kill_urb not necessary, urb is aborted automatically */ +usb_kill_urb (bcd2k->midi_out_urb); +usb_kill_urb (bcd2k->midi_in_urb);usb_free_urb (bcd2k->midi_out_urb);usb_free_urb (bcd2k->midi_in_urb);
Greg Kroah-Hartman
maintainerPATCH 28/101 add barriers to buffer_uptodate and set_buffer_uptodate
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit d4252071b97d2027d246f6a82cbee4d52f618b47 upstream.
Let's have a look at this piece of code in __bread_slow:
get_bh(bh); bh->b_end_io = end_buffer_read_sync; submit_bh(REQ_OP_READ, 0, bh); wait_on_buffer(bh); if (buffer_uptodate(bh)) return bh;
Neither wait_on_buffer nor buffer_uptodate contain any memory barrier. Consequently, if someone calls sb_bread and then reads the buffer data, the read of buffer data may be executed before wait_on_buffer(bh) on architectures with weak memory ordering and it may return invalid data.
Fix this bug by adding a memory barrier to set_buffer_uptodate and an acquire barrier to buffer_uptodate (in a similar way as folio_test_uptodate and folio_mark_uptodate).
--- include/linux/buffer_head.h | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-)
include/linux/buffer_head.h +24 -1
@@ -113,7 +113,6 @@ static __always_inline int test_clear_bu* of the form "mark_buffer_foo()". These are higher-level functions which * do something in addition to setting a b_state bit. */ -BUFFER_FNS(Uptodate, uptodate) BUFFER_FNS(Dirty, dirty) TAS_BUFFER_FNS(Dirty, dirty)BUFFER_FNS (Lock, locked)
@@ -131,6 +130,30 @@ BUFFER_FNS(Meta, meta) BUFFER_FNS(Prio, prio) BUFFER_FNS(Defer_Completion, defer_completion) +static __always_inline void set_buffer_uptodate(struct buffer_head *bh) +{ +/* +* make it consistent with folio_mark_uptodate +* pairs with smp_load_acquire in buffer_uptodate +*/ +smp_mb__before_atomic (); +set_bit (BH_Uptodate, &bh->b_state); +} + +static __always_inline void clear_buffer_uptodate(struct buffer_head *bh) +{ +clear_bit (BH_Uptodate, &bh->b_state); +} + +static __always_inline int buffer_uptodate(const struct buffer_head *bh) +{ +/* +* make it consistent with folio_test_uptodate +* pairs with smp_mb__before_atomic in set_buffer_uptodate +*/ +return (smp_load_acquire (&bh->b_state) & (1UL << BH_Uptodate)) !=0 ; +} +#define bh_offset (bh) ((unsigned long)(bh)->b_data & ~PAGE_MASK)/* If we *know* page->private refers to buffer_heads */
Greg Kroah-Hartman
maintainerPATCH 29/101 KVM: SVM: Dont BUG if userspace injects an interrupt with GIF=0
In reply to Greg Kroah-HartmanFrom: Maciej S. Szmigiero <[email protected]>
commit f17c31c48e5cde9895a491d91c424eeeada3e134 upstream.
Don't BUG/WARN on interrupt injection due to GIF being cleared, since it's trivial for userspace to force the situation via KVM_SET_VCPU_EVENTS (even if having at least a WARN there would be correct for KVM internally generated injections).
kernel BUG at arch/x86/kvm/svm/svm.c:3386!
invalid opcode: 0000 [#1] SMP
CPU: 15 PID: 926 Comm: smm_test Not tainted 5.17.0-rc3+ #264 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 RIP: 0010:svm_inject_irq+0xab/0xb0 [kvm_amd] Code: <0f> 0b 0f 1f 00 0f 1f 44 00 00 80 3d ac b3 01 00 00 55 48 89 f5 53 RSP: 0018:ffffc90000b37d88 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff88810a234ac0 RCX: 0000000000000006 RDX: 0000000000000000 RSI: ffffc90000b37df7 RDI: ffff88810a234ac0 RBP: ffffc90000b37df7 R08: ffff88810a1fa410 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000 R13: ffff888109571000 R14: ffff88810a234ac0 R15: 0000000000000000 FS: 0000000001821380(0000) GS:ffff88846fdc0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f74fc550008 CR3: 000000010a6fe000 CR4: 0000000000350ea0 Call Trace: <TASK> inject_pending_event+0x2f7/0x4c0 [kvm] kvm_arch_vcpu_ioctl_run+0x791/0x17a0 [kvm] kvm_vcpu_ioctl+0x26d/0x650 [kvm] __x64_sys_ioctl+0x82/0xb0 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK>
Message-Id: <35426af6e123cbe91ec7ce5132ce72521f02b1b5.1651440202.git.maciej.szmigiero@oracle.com>
--- arch/x86/kvm/svm.c | 2 -- 1 file changed, 2 deletions(-)
arch/x86/kvm/svm.c +0 -2
@@ -4492,8 +4492,6 @@ static void svm_set_irq(struct kvm_vcpu {struct vcpu_svm *svm =to_svm (vcpu); -BUG_ON (!(gif_set (svm))); -trace_kvm_inj_virq (vcpu->arch.interrupt.nr); ++vcpu->stat.irq_injections;
Greg Kroah-Hartman
maintainerPATCH 30/101 KVM: x86: Mark TSS busy during LTR emulation _after_ all fault checks
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
commit ec6e4d863258d4bfb36d48d5e3ef68140234d688 upstream.
Wait to mark the TSS as busy during LTR emulation until after all fault checks for the LTR have passed. Specifically, don't mark the TSS busy if the new TSS base is non-canonical.
Opportunistically drop the one-off !seg_desc.PRESENT check for TR as the only reason for the early check was to avoid marking a !PRESENT TSS as busy, i.e. the common !PRESENT is now done before setting the busy bit.
--- arch/x86/kvm/emulate.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
arch/x86/kvm/emulate.c +9 -10
@@ -1713,16 +1713,6 @@ static int __load_segment_descriptor(strcase VCPU_SREG_TR :if (seg_desc.s || (seg_desc.type !=1 && seg_desc.type !=9 )) goto exception; -if (!seg_desc.p) { - err_vec =NP_VECTOR ; - goto exception; - } - old_desc = seg_desc; - seg_desc.type |=2 ;/* busy */ - ret = ctxt->ops->cmpxchg_emulated (ctxt, desc_addr, &old_desc, &seg_desc, -sizeof (seg_desc), &ctxt->exception); -if (ret !=X86EMUL_CONTINUE ) -return ret;break ;case VCPU_SREG_LDTR :if (seg_desc.s || seg_desc.type !=2 )
@@ -1763,6 +1753,15 @@ static int __load_segment_descriptor(str ((u64)base3 << 32)))return emulate_gp (ctxt,0 ); } + +if (seg ==VCPU_SREG_TR ) { + old_desc = seg_desc; + seg_desc.type |=2 ;/* busy */ + ret = ctxt->ops->cmpxchg_emulated (ctxt, desc_addr, &old_desc, &seg_desc, +sizeof (seg_desc), &ctxt->exception); +if (ret !=X86EMUL_CONTINUE ) +return ret; + } load: ctxt->ops->set_segment (ctxt, selector, &seg_desc, base3, seg);if (desc)
Greg Kroah-Hartman
maintainerPATCH 31/101 ALSA: hda/conexant: Add quirk for LENOVO 20149 Notebook model
In reply to Greg Kroah-HartmanFrom: Meng Tang <[email protected]>
commit f83bb2592482fe94c6eea07a8121763c80f36ce5 upstream.
There is another LENOVO 20149 (Type1Sku0) Notebook model with CX20590, the device PCI SSID is 17aa:3977, which headphones are not responding, that requires the quirk CXT_PINCFG_LENOVO_NOTEBOOK. Add the corresponding entry to the quirk table.
--- sound/pci/hda/patch_conexant.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
sound/pci/hda/patch_conexant.c +10 -1
@@ -238,6 +238,7 @@ enum {CXT_PINCFG_LEMOTE_A1205 ,CXT_PINCFG_COMPAQ_CQ60 ,CXT_FIXUP_STEREO_DMIC , +CXT_PINCFG_LENOVO_NOTEBOOK ,CXT_FIXUP_INC_MIC_BOOST ,CXT_FIXUP_HEADPHONE_MIC_PIN , CXT_FIXUP_HEADPHONE_MIC,
@@ -698,6 +699,14 @@ static const struct hda_fixup cxt_fixups .type = HDA_FIXUP_FUNC, .v.func = cxt_fixup_stereo_dmic, }, + [CXT_PINCFG_LENOVO_NOTEBOOK] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x1a ,0x05d71030 }, + { } + }, + .chain_id = CXT_FIXUP_STEREO_DMIC, + }, [CXT_FIXUP_INC_MIC_BOOST] = { .type = HDA_FIXUP_FUNC, .v.func = cxt5066_increase_mic_boost,
@@ -860,7 +869,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x3905 ,"Lenovo G50-30" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ), -SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_FIXUP_STEREO_DMIC ), +SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_PINCFG_LENOVO_NOTEBOOK ),SND_PCI_QUIRK (0x17aa ,0x3978 ,"Lenovo G50-70" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x397b ,"Lenovo S205" ,CXT_FIXUP_STEREO_DMIC ), SND_PCI_QUIRK_VENDOR(0x17aa, "Thinkpad", CXT_FIXUP_THINKPAD_ACPI),
Greg Kroah-Hartman
maintainerPATCH 32/101 ALSA: hda/cirrus - support for iMac 12,1 model
In reply to Greg Kroah-HartmanFrom: Allen Ballway <[email protected]>
commit 74bba640d69914cf832b87f6bbb700e5ba430672 upstream.
The 12,1 model requires the same configuration as the 12,2 model to enable headphones but has a different codec SSID. Adds 12,1 SSID for matching quirk.
[ re-sorted in SSID order by tiwai ]
--- sound/pci/hda/patch_cirrus.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_cirrus.c +1 -0
@@ -409,6 +409,7 @@ static const struct snd_pci_quirk cs420x/* codec SSID */ SND_PCI_QUIRK (0x106b ,0x0600 ,"iMac 14,1" ,CS420X_IMAC27_122 ), +SND_PCI_QUIRK (0x106b ,0x0900 ,"iMac 12,1" ,CS420X_IMAC27_122 ),SND_PCI_QUIRK (0x106b ,0x1c00 ,"MacBookPro 8,1" ,CS420X_MBP81 ),SND_PCI_QUIRK (0x106b ,0x2000 ,"iMac 12,2" ,CS420X_IMAC27_122 ), SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
Greg Kroah-Hartman
maintainerPATCH 33/101 vfs: Check the truncate maximum size in inode_newsize_ok()
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
commit e2ebff9c57fe4eb104ce4768f6ebcccf76bef849 upstream.
If something manages to set the maximum file size to MAX_OFFSET+1, this can cause the xfs and ext4 filesystems at least to become corrupt.
Ordinarily, the kernel protects against userspace trying this by checking the value early in the truncate() and ftruncate() system calls calls - but there are at least two places that this check is bypassed:
(1) Cachefiles will round up the EOF of the backing file to DIO block size so as to allow DIO on the final block - but this might push the offset negative. It then calls notify_change(), but this inadvertently bypasses the checking. This can be triggered if someone puts an 8EiB-1 file on a server for someone else to try and access by, say, nfs.
(2) ksmbd doesn't check the value it is given in set_end_of_file_info() and then calls vfs_truncate() directly - which also bypasses the check.
In both cases, it is potentially possible for a network filesystem to cause a disk filesystem to be corrupted: cachefiles in the client's cache filesystem; ksmbd in the server's filesystem.
nfsd is okay as it checks the value, but we can then remove this check too.
Fix this by adding a check to inode_newsize_ok(), as called from setattr_prepare(), thereby catching the issue as filesystems set up to perform the truncate with minimal opportunity for bypassing the new check.
--- fs/attr.c | 2 ++ 1 file changed, 2 insertions(+)
fs/attr.c +2 -0
@@ -111,6 +111,8 @@ EXPORT_SYMBOL(setattr_prepare);*/ int inode_newsize_ok (const struct inode *inode,loff_t offset) { +if (offset <0 ) +return -EINVAL ;if (inode->i_size < offset) {unsigned long limit;
Greg Kroah-Hartman
maintainerPATCH 34/101 usbnet: Fix linkwatch use-after-free on disconnect
In reply to Greg Kroah-HartmanFrom: Lukas Wunner <[email protected]>
commit a69e617e533edddf3fa3123149900f36e0a6dc74 upstream.
usbnet uses the work usbnet_deferred_kevent() to perform tasks which may sleep. On disconnect, completion of the work was originally awaited in ->ndo_stop(). But in 2003, that was moved to ->disconnect() by historic commit "[PATCH] USB: usbnet, prevent exotic rtnl deadlock":
https://git.kernel.org/tglx/history/c/0f138bbfd83c
The change was made because back then, the kernel's workqueue implementation did not allow waiting for a single work. One had to wait for completion of *all* work by calling flush_scheduled_work(), and that could deadlock when waiting for usbnet_deferred_kevent() with rtnl_mutex held in ->ndo_stop().
The commit solved one problem but created another: It causes a use-after-free in USB Ethernet drivers aqc111.c, asix_devices.c, ax88179_178a.c, ch9200.c and smsc75xx.c:
* If the drivers receive a link change interrupt immediately before disconnect, they raise EVENT_LINK_RESET in their (non-sleepable) ->status() callback and schedule usbnet_deferred_kevent().
* usbnet_deferred_kevent() invokes the driver's ->link_reset() callback, which calls netif_carrier_{on,off}().
* That in turn schedules the work linkwatch_event().
Because usbnet_deferred_kevent() is awaited after unregister_netdev(), netif_carrier_{on,off}() may operate on an unregistered netdev and linkwatch_event() may run after free_netdev(), causing a use-after-free.
In 2010, usbnet was changed to only wait for a single instance of usbnet_deferred_kevent() instead of *all* work by commit 23f333a2bfaf ("drivers/net: don't use flush_scheduled_work()").
Unfortunately the commit neglected to move the wait back to ->ndo_stop(). Rectify that omission at long last.
--- drivers/net/usb/usbnet.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/net/usb/usbnet.c +2 -6
@@ -847,13 +847,11 @@ int usbnet_stop (struct net_device *net) mpn = !test_and_clear_bit (EVENT_NO_RUNTIME_PM , &dev->flags); -/* deferred work (task, timer, softirq) must also stop. -* can't flush_scheduled_work() until we drop rtnl (later), -* else workers could deadlock; so make workers a NOP. -*/ +/* deferred work (timer, softirq, task) must also stop */ dev->flags =0 ;del_timer_sync (&dev->delay);tasklet_kill (&dev->bh); +cancel_work_sync (&dev->kevent);if (!pm)usb_autopm_put_interface (dev->intf);
@@ -1577,8 +1575,6 @@ void usbnet_disconnect (struct usb_inter net = dev->net;unregister_netdev (net); -cancel_work_sync (&dev->kevent); -usb_scuttle_anchored_urbs (&dev->deferred);if (dev->driver_info->unbind)
Greg Kroah-Hartman
maintainerPATCH 35/101 parisc: Fix device names in /proc/iomem
In reply to Greg Kroah-HartmanFrom: Helge Deller <[email protected]>
commit cab56b51ec0e69128909cef4650e1907248d821b upstream.
Fix the output of /proc/iomem to show the real hardware device name including the pa_pathname, e.g. "Merlin 160 Core Centronics [8:16:0]". Up to now only the pa_pathname ("[8:16.0]") was shown.
--- arch/parisc/kernel/drivers.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
arch/parisc/kernel/drivers.c +4 -5
@@ -504,7 +504,6 @@ alloc_pa_dev(unsigned long hpa, struct h dev->id.hversion_rev = iodc_data[1 ] &0x0f ; dev->id.sversion = ((iodc_data[4 ] &0x0f ) <<16 ) | (iodc_data[5 ] <<8 ) | iodc_data[6 ]; - dev->hpa.name =parisc_pathname (dev); dev->hpa.start = hpa;/* This is awkward. The STI spec says that gfx devices may occupy * 32MB or 64MB. Unfortunately, we don't know how to tell whether
@@ -518,10 +517,10 @@ alloc_pa_dev(unsigned long hpa, struct h dev->hpa.end = hpa +0xfff ; } dev->hpa.flags =IORESOURCE_MEM ; - name =parisc_hardware_description (&dev->id); -if (name) { -strlcpy (dev->name, name,sizeof (dev->name)); - } + dev->hpa.name = dev->name; + name =parisc_hardware_description (&dev->id) ? :"unknown" ; +snprintf (dev->name,sizeof (dev->name),"%s [%s]" , + name,parisc_pathname (dev));/* Silently fail things like mouse ports which are subsumed within * the keyboard controller
Greg Kroah-Hartman
maintainerPATCH 36/101 drm/nouveau: fix another off-by-one in nvbios_addr
In reply to Greg Kroah-HartmanFrom: Timur Tabi <[email protected]>
commit c441d28945fb113220d48d6c86ebc0b090a2b677 upstream.
This check determines whether a given address is part of image 0 or image 1. Image 1 starts at offset image0_size, so that address should be included.
--- drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nvkm/subdev/bios/base.c +1 -1
@@ -33,7 +33,7 @@ nvbios_addr(struct nvkm_bios *bios, u32 {u32 p = *addr; -if (*addr > bios->image0_size && bios->imaged_addr) { +if (*addr >= bios->image0_size && bios->imaged_addr) { *addr -= bios->image0_size; *addr += bios->imaged_addr; }
Greg Kroah-Hartman
maintainerPATCH 37/101 bpf: fix overflow in prog accounting
In reply to Greg Kroah-HartmanFrom: Daniel Borkmann <[email protected]>
commit 5ccb071e97fbd9ffe623a0d3977cc6d013bee93c upstream.
Commit aaac3ba95e4c ("bpf: charge user for creation of BPF maps and programs") made a wrong assumption of charging against prog->pages. Unlike map->pages, prog->pages are still subject to change when we need to expand the program through bpf_prog_realloc().
This can for example happen during verification stage when we need to expand and rewrite parts of the program. Should the required space cross a page boundary, then prog->pages is not the same anymore as its original value that we used to bpf_prog_charge_memlock() on. Thus, we'll hit a wrap-around during bpf_prog_uncharge_memlock() when prog is freed eventually. I noticed this that despite having unlimited memlock, programs suddenly refused to load with EPERM error due to insufficient memlock.
There are two ways to fix this issue. One would be to add a cached variable to struct bpf_prog that takes a snapshot of prog->pages at the time of charging. The other approach is to also account for resizes. I chose to go with the latter for a couple of reasons: i) We want accounting rather to be more accurate instead of further fooling limits, ii) adding yet another page counter on struct bpf_prog would also be a waste just for this purpose. We also do want to charge as early as possible to avoid going into the verifier just to find out later on that we crossed limits. The only place that needs to be fixed is bpf_prog_realloc(), since only here we expand the program, so we try to account for the needed delta and should we fail, call-sites check for outcome anyway. On cBPF to eBPF migrations, we don't grab a reference to the user as they are charged differently. With that in place, my test case worked fine.
--- include/linux/bpf.h | 11 +++++++++++ kernel/bpf/core.c | 16 +++++++++++++--- kernel/bpf/syscall.c | 36 ++++++++++++++++++++++++++++-------- 3 files changed, 52 insertions(+), 11 deletions(-)
include/linux/bpf.h +11 -0
@@ -246,6 +246,8 @@ struct bpf_prog *bpf_prog_get_type(u32 ustruct bpf_prog *bpf_prog_add (struct bpf_prog *prog,int i);struct bpf_prog *bpf_prog_inc (struct bpf_prog *prog);void bpf_prog_put (struct bpf_prog *prog); +int __bpf_prog_charge (struct user_struct *user,u32 pages); +void __bpf_prog_uncharge (struct user_struct *user,u32 pages);struct bpf_map *bpf_map_get_with_uref (u32 ufd);struct bpf_map *__bpf_map_get (struct fd f);
@@ -328,6 +330,15 @@ static inline struct bpf_prog *bpf_prog_return ERR_PTR (-EOPNOTSUPP ); } +static inline int __bpf_prog_charge (struct user_struct *user,u32 pages) +{ +return 0 ; +} + +static inline void __bpf_prog_uncharge (struct user_struct *user,u32 pages) +{ +} +static inline bool unprivileged_ebpf_enabled (void ) {return false;
kernel/bpf/core.c +13 -3
@@ -107,19 +107,29 @@ struct bpf_prog *bpf_prog_realloc(structgfp_t gfp_flags =GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO | gfp_extra_flags;struct bpf_prog *fp; +u32 pages, delta; +int ret;BUG_ON (fp_old ==NULL ); size =round_up (size,PAGE_SIZE ); -if (size <= fp_old->pages *PAGE_SIZE ) + pages = size /PAGE_SIZE ; +if (pages <= fp_old->pages)return fp_old; + delta = pages - fp_old->pages; + ret =__bpf_prog_charge (fp_old->aux->user, delta); +if (ret) +return NULL ; + fp =__vmalloc (size, gfp_flags,PAGE_KERNEL ); -if (fp !=NULL ) { +if (fp ==NULL ) { +__bpf_prog_uncharge (fp_old->aux->user, delta); + }else {kmemcheck_annotate_bitfield (fp, meta);memcpy (fp, fp_old, fp_old->pages *PAGE_SIZE ); - fp->pages = size /PAGE_SIZE ; + fp->pages = pages; fp->aux->prog = fp;/* We keep fp->aux from fp_old around in the new
kernel/bpf/syscall.c +28 -8
@@ -581,19 +581,39 @@ static void free_used_maps(struct bpf_prkfree (aux->used_maps); } +int __bpf_prog_charge (struct user_struct *user,u32 pages) +{ +unsigned long memlock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; +unsigned long user_bufs; + +if (user) { + user_bufs =atomic_long_add_return (pages, &user->locked_vm); +if (user_bufs > memlock_limit) { +atomic_long_sub (pages, &user->locked_vm); +return -EPERM ; + } + } + +return 0 ; +} + +void __bpf_prog_uncharge (struct user_struct *user,u32 pages) +{ +if (user) +atomic_long_sub (pages, &user->locked_vm); +} +static int bpf_prog_charge_memlock (struct bpf_prog *prog) {struct user_struct *user =get_current_user (); -unsigned long memlock_limit; - - memlock_limit =rlimit (RLIMIT_MEMLOCK ) >>PAGE_SHIFT ; +int ret; -atomic_long_add (prog->pages, &user->locked_vm); -if (atomic_long_read (&user->locked_vm) > memlock_limit) { -atomic_long_sub (prog->pages, &user->locked_vm); + ret =__bpf_prog_charge (user, prog->pages); +if (ret) {free_uid (user); -return -EPERM ; +return ret; } + prog->aux->user = user;return 0 ; }
@@ -602,7 +622,7 @@ static void bpf_prog_uncharge_memlock(st {struct user_struct *user = prog->aux->user; -atomic_long_sub (prog->pages, &user->locked_vm); +__bpf_prog_uncharge (user, prog->pages);free_uid (user); }
Greg Kroah-Hartman
maintainerPATCH 38/101 fuse: limit nsec
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
commit 47912eaa061a6a81e4aa790591a1874c650733c0 upstream.
Limit nanoseconds to 0..999999999.
--- fs/fuse/inode.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/fuse/inode.c +6 -0
@@ -173,6 +173,12 @@ void fuse_change_attributes_common(struc inode->i_uid =make_kuid (&init_user_ns, attr->uid); inode->i_gid =make_kgid (&init_user_ns, attr->gid); inode->i_blocks = attr->blocks; + +/* Sanitize nsecs */ + attr->atimensec =min_t (u32, attr->atimensec,NSEC_PER_SEC -1 ); + attr->mtimensec =min_t (u32, attr->mtimensec,NSEC_PER_SEC -1 ); + attr->ctimensec =min_t (u32, attr->ctimensec,NSEC_PER_SEC -1 ); + inode->i_atime.tv_sec = attr->atime; inode->i_atime.tv_nsec = attr->atimensec;/* mtime from server may be stale due to local buffered write */
Greg Kroah-Hartman
maintainerPATCH 39/101 md-raid10: fix KASAN warning
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit d17f744e883b2f8d13cca252d71cfe8ace346f7d upstream.
There's a KASAN warning in raid10_remove_disk when running the lvm test lvconvert-raid-reshape.sh. We fix this warning by verifying that the value "number" is valid.
BUG: KASAN: slab-out-of-bounds in raid10_remove_disk+0x61/0x2a0 [raid10] Read of size 8 at addr ffff889108f3d300 by task mdX_raid10/124682 CPU: 3 PID: 124682 Comm: mdX_raid10 Not tainted 5.19.0-rc6 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 Call Trace: <TASK> dump_stack_lvl+0x34/0x44 print_report.cold+0x45/0x57a ? __lock_text_start+0x18/0x18 ? raid10_remove_disk+0x61/0x2a0 [raid10] kasan_report+0xa8/0xe0 ? raid10_remove_disk+0x61/0x2a0 [raid10] raid10_remove_disk+0x61/0x2a0 [raid10] Buffer I/O error on dev dm-76, logical block 15344, async page read ? __mutex_unlock_slowpath.constprop.0+0x1e0/0x1e0 remove_and_add_spares+0x367/0x8a0 [md_mod] ? super_written+0x1c0/0x1c0 [md_mod] ? mutex_trylock+0xac/0x120 ? _raw_spin_lock+0x72/0xc0 ? _raw_spin_lock_bh+0xc0/0xc0 md_check_recovery+0x848/0x960 [md_mod] raid10d+0xcf/0x3360 [raid10] ? sched_clock_cpu+0x185/0x1a0 ? rb_erase+0x4d4/0x620 ? var_wake_function+0xe0/0xe0 ? psi_group_change+0x411/0x500 ? preempt_count_sub+0xf/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? raid10_sync_request+0x36c0/0x36c0 [raid10] ? preempt_count_sub+0xf/0xc0 ? _raw_spin_unlock_irqrestore+0x19/0x40 ? del_timer_sync+0xa9/0x100 ? try_to_del_timer_sync+0xc0/0xc0 ? _raw_spin_lock_irqsave+0x78/0xc0 ? __lock_text_start+0x18/0x18 ? _raw_spin_unlock_irq+0x11/0x24 ? __list_del_entry_valid+0x68/0xa0 ? finish_wait+0xa3/0x100 md_thread+0x161/0x260 [md_mod] ? unregister_md_personality+0xa0/0xa0 [md_mod] ? _raw_spin_lock_irqsave+0x78/0xc0 ? prepare_to_wait_event+0x2c0/0x2c0 ? unregister_md_personality+0xa0/0xa0 [md_mod] kthread+0x148/0x180 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x1f/0x30 </TASK> Allocated by task 124495: kasan_save_stack+0x1e/0x40 __kasan_kmalloc+0x80/0xa0 setup_conf+0x140/0x5c0 [raid10] raid10_run+0x4cd/0x740 [raid10] md_run+0x6f9/0x1300 [md_mod] raid_ctr+0x2531/0x4ac0 [dm_raid] dm_table_add_target+0x2b0/0x620 [dm_mod] table_load+0x1c8/0x400 [dm_mod] ctl_ioctl+0x29e/0x560 [dm_mod] dm_compat_ctl_ioctl+0x7/0x20 [dm_mod] __do_compat_sys_ioctl+0xfa/0x160 do_syscall_64+0x90/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 L __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 Second to last potentially related work creation: kasan_save_stack+0x1e/0x40 __kasan_record_aux_stack+0x9e/0xc0 kvfree_call_rcu+0x84/0x480 timerfd_release+0x82/0x140 __fput+0xfa/0x400 task_work_run+0x80/0xc0 exit_to_user_mode_prepare+0x155/0x160 syscall_exit_to_user_mode+0x12/0x40 do_syscall_64+0x42/0xc0 entry_SYSCALL_64_after_hwframe+0x46/0xb0 The buggy address belongs to the object at ffff889108f3d200 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 0 bytes to the right of
256-byte region [ffff889108f3d200, ffff889108f3d300)
The buggy address belongs to the physical page:
page:000000007ef2a34c refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1108f3c
head:000000007ef2a34c order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head|zone=2)
raw: 4000000000010200 0000000000000000 dead000000000001 ffff889100042b40
raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff889108f3d200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff889108f3d280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff889108f3d300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff889108f3d380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff889108f3d400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00--- drivers/md/raid10.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/raid10.c +4 -1
@@ -1785,9 +1785,12 @@ static int raid10_remove_disk(struct mddint err =0 ;int number = rdev->raid_disk;struct md_rdev **rdevp; -struct raid10_info *p = conf->mirrors + number; +struct raid10_info *p;print_conf (conf); +if (unlikely (number >= mddev->raid_disks)) +return 0 ; + p = conf->mirrors + number;if (rdev == p->rdev) rdevp = &p->rdev;else if (rdev == p->replacement)
Greg Kroah-Hartman
maintainerPATCH 40/101 ia64, processor: fix -Wincompatible-pointer-types in ia64_get_irr()
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit e5a16a5c4602c119262f350274021f90465f479d upstream.
test_bit(), as any other bitmap op, takes unsigned long * as a second argument (pointer to the actual bitmap), as any bitmap itself is an array of unsigned longs. However, the ia64_get_irr() code passes a ref to u64 as a second argument.
This works with the ia64 bitops implementation due to that they have void * as the second argument and then cast it later on. This works with the bitmap API itself due to that unsigned long has the same size on ia64 as u64 (unsigned long long), but from the compiler PoV those two are different.
Define @irr as unsigned long to fix that. That implies no functional changes. Has been hidden for 16 years!
--- arch/ia64/include/asm/processor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/ia64/include/asm/processor.h +1 -1
@@ -554,7 +554,7 @@ ia64_get_irr(unsigned int vector) {unsigned int reg = vector /64 ;unsigned int bit = vector %64 ; -u64 irr; +unsigned long irr;switch (reg) {case 0 : irr =ia64_getreg (_IA64_REG_CR_IRR0);break ;
Greg Kroah-Hartman
maintainerPATCH 41/101 PCI: Add defines for normal and subtractive PCI bridges
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 904b10fb189cc15376e9bfce1ef0282e68b0b004 upstream.
Add these PCI class codes to pci_ids.h:
PCI_CLASS_BRIDGE_PCI_NORMAL
PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE
Use these defines in all kernel code for describing PCI class codes for normal and subtractive PCI bridges.
--- include/linux/pci_ids.h | 2 ++ 1 file changed, 2 insertions(+)
include/linux/pci_ids.h +2 -0
@@ -55,6 +55,8 @@#define PCI_CLASS_BRIDGE_EISA 0x0602#define PCI_CLASS_BRIDGE_MC 0x0603#define PCI_CLASS_BRIDGE_PCI 0x0604 +#define PCI_CLASS_BRIDGE_PCI_NORMAL 0x060400 +#define PCI_CLASS_BRIDGE_PCI_SUBTRACTIVE 0x060401#define PCI_CLASS_BRIDGE_PCMCIA 0x0605#define PCI_CLASS_BRIDGE_NUBUS 0x0606#define PCI_CLASS_BRIDGE_CARDBUS 0x0607
Greg Kroah-Hartman
maintainerPATCH 42/101 powerpc/fsl-pci: Fix Class Code of PCIe Root Port
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
commit 0c551abfa004ce154d487d91777bf221c808a64f upstream.
By default old pre-3.0 Freescale PCIe controllers reports invalid PCI Class Code 0x0b20 for PCIe Root Port. It can be seen by lspci -b output on P2020 board which has this pre-3.0 controller:
$ lspci -bvnn
00:00.0 Power PC [0b20]: Freescale Semiconductor Inc P2020E [1957:0070] (rev 21)
!!! Invalid class 0b20 for header type 01
Capabilities: [4c] Express Root Port (Slot-), MSI 00Fix this issue by programming correct PCI Class Code 0x0604 for PCIe Root Port to the Freescale specific PCIe register 0x474.
With this change lspci -b output is:
$ lspci -bvnn
00:00.0 PCI bridge [0604]: Freescale Semiconductor Inc P2020E [1957:0070] (rev 21) (prog-if 00 [Normal decode])
Capabilities: [4c] Express Root Port (Slot-), MSI 00Without any "Invalid class" error. So class code was properly reflected into standard (read-only) PCI register 0x08.
Same fix is already implemented in U-Boot pcie_fsl.c driver in commit:
http://source.denx.de/u-boot/u-boot/-/commit/d18d06ac35229345a0af80977a408cfbe1d1015b
Fix activated by U-Boot stay active also after booting Linux kernel. But boards which use older U-Boot version without that fix are affected and still require this fix.
So implement this class code fix also in kernel fsl_pci.c driver.
--- arch/powerpc/sysdev/fsl_pci.c | 8 ++++++++ arch/powerpc/sysdev/fsl_pci.h | 1 + 2 files changed, 9 insertions(+)
arch/powerpc/sysdev/fsl_pci.c +8 -0
@@ -524,6 +524,7 @@ int fsl_add_bridge(struct platform_devicstruct resource rsrc;const int *bus_range;u8 hdr_type, progif; +u32 class_code;struct device_node *dev;struct ccsr_pci __iomem *pci;u16 temp;
@@ -597,6 +598,13 @@ int fsl_add_bridge(struct platform_devicPPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS ;if (fsl_pcie_check_link (hose)) hose->indirect_type |=PPC_INDIRECT_TYPE_NO_PCIE_LINK ; +/* Fix Class Code to PCI_CLASS_BRIDGE_PCI_NORMAL for pre-3.0 controller */ +if (in_be32 (&pci->block_rev1) <PCIE_IP_REV_3_0 ) { +early_read_config_dword (hose,0 ,0 ,PCIE_FSL_CSR_CLASSCODE , &class_code); + class_code &=0xff ; + class_code |=PCI_CLASS_BRIDGE_PCI_NORMAL <<8 ; +early_write_config_dword (hose,0 ,0 ,PCIE_FSL_CSR_CLASSCODE , class_code); + } }else {/* * Set PBFR(PCI Bus Function Register)[10] = 1 to
arch/powerpc/sysdev/fsl_pci.h +1 -0
@@ -23,6 +23,7 @@ struct platform_device;#define PCIE_LTSSM 0x0404/* PCIE Link Training and Status */ #define PCIE_LTSSM_L0 0x16/* L0 state */ +#define PCIE_FSL_CSR_CLASSCODE 0x474/* FSL GPEX CSR */ #define PCIE_IP_REV_2_2 0x02080202/* PCIE IP block version Rev2.2 */ #define PCIE_IP_REV_3_0 0x02080300/* PCIE IP block version Rev3.0 */ #define PIWAR_EN 0x80000000/* Enable */
Greg Kroah-Hartman
maintainerPATCH 43/101 powerpc/powernv: Avoid crashing if rng is NULL
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
commit 90b5d4fe0b3ba7f589c6723c6bfb559d9e83956a upstream.
On a bare-metal Power8 system that doesn't have an "ibm,power-rng", a malicious QEMU and guest that ignore the absence of the KVM_CAP_PPC_HWRNG flag, and calls H_RANDOM anyway, will dereference a NULL pointer.
In practice all Power8 machines have an "ibm,power-rng", but let's not rely on that, add a NULL check and early return in powernv_get_random_real_mode().
--- arch/powerpc/platforms/powernv/rng.c | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/platforms/powernv/rng.c +2 -0
@@ -67,6 +67,8 @@ int powernv_get_random_real_mode(unsignestruct powernv_rng *rng; rng =raw_cpu_read (powernv_rng); +if (!rng) +return 0 ; *v =rng_whiten (rng,in_rm64 (rng->regs_real));
Greg Kroah-Hartman
maintainerPATCH 44/101 MIPS: cpuinfo: Fix a warning for CONFIG_CPUMASK_OFFSTACK
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit e1a534f5d074db45ae5cbac41d8912b98e96a006 upstream.
When CONFIG_CPUMASK_OFFSTACK and CONFIG_DEBUG_PER_CPU_MAPS is selected, cpu_max_bits_warn() generates a runtime warning similar as below while we show /proc/cpuinfo. Fix this by using nr_cpu_ids (the runtime limit) instead of NR_CPUS to iterate CPUs.
[ 3.052463] ------------[ cut here ]------------ [ 3.059679] WARNING: CPU: 3 PID: 1 at include/linux/cpumask.h:108 show_cpuinfo+0x5e8/0x5f0 [ 3.070072] Modules linked in: efivarfs autofs4 [ 3.076257] CPU: 0 PID: 1 Comm: systemd Not tainted 5.19-rc5+ #1052 [ 3.084034] Hardware name: Loongson Loongson-3A4000-7A1000-1w-V0.1-CRB/Loongson-LS3A4000-7A1000-1w-EVB-V1.21, BIOS Loongson-UDK2018-V2.0.04082-beta7 04/27 [ 3.099465] Stack : 9000000100157b08 9000000000f18530 9000000000cf846c 9000000100154000 [ 3.109127] 9000000100157a50 0000000000000000 9000000100157a58 9000000000ef7430 [ 3.118774] 90000001001578e8 0000000000000040 0000000000000020 ffffffffffffffff [ 3.128412] 0000000000aaaaaa 1ab25f00eec96a37 900000010021de80 900000000101c890 [ 3.138056] 0000000000000000 0000000000000000 0000000000000000 0000000000aaaaaa [ 3.147711] ffff8000339dc220 0000000000000001 0000000006ab4000 0000000000000000 [ 3.157364] 900000000101c998 0000000000000004 9000000000ef7430 0000000000000000 [ 3.167012] 0000000000000009 000000000000006c 0000000000000000 0000000000000000 [ 3.176641] 9000000000d3de08 9000000001639390 90000000002086d8 00007ffff0080286 [ 3.186260] 00000000000000b0 0000000000000004 0000000000000000 0000000000071c1c [ 3.195868] ... [ 3.199917] Call Trace: [ 3.203941] [<98000000002086d8>] show_stack+0x38/0x14c [ 3.210666] [<9800000000cf846c>] dump_stack_lvl+0x60/0x88 [ 3.217625] [<980000000023d268>] __warn+0xd0/0x100 [ 3.223958] [<9800000000cf3c90>] warn_slowpath_fmt+0x7c/0xcc [ 3.231150] [<9800000000210220>] show_cpuinfo+0x5e8/0x5f0 [ 3.238080] [<98000000004f578c>] seq_read_iter+0x354/0x4b4 [ 3.245098] [<98000000004c2e90>] new_sync_read+0x17c/0x1c4 [ 3.252114] [<98000000004c5174>] vfs_read+0x138/0x1d0 [ 3.258694] [<98000000004c55f8>] ksys_read+0x70/0x100 [ 3.265265] [<9800000000cfde9c>] do_syscall+0x7c/0x94 [ 3.271820] [<9800000000202fe4>] handle_syscall+0xc4/0x160 [ 3.281824] ---[ end trace 8b484262b4b8c24c ]---
--- arch/mips/kernel/proc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/kernel/proc.c +1 -1
@@ -162,7 +162,7 @@ static void *c_start(struct seq_file *m, {unsigned long i = *pos; -return i <NR_CPUS ? (void *) (i +1 ) :NULL ; +return i < nr_cpu_ids ? (void *) (i +1 ) :NULL ; }static void *c_next (struct seq_file *m,void *v,loff_t *pos)
Greg Kroah-Hartman
maintainerPATCH 45/101 USB: HCD: Fix URB giveback issue in tasklet function
In reply to Greg Kroah-HartmanFrom: Weitao Wang <[email protected]>
commit 26c6c2f8a907c9e3a2f24990552a4d77235791e6 upstream.
Usb core introduce the mechanism of giveback of URB in tasklet context to reduce hardware interrupt handling time. On some test situation(such as FIO with 4KB block size), when tasklet callback function called to giveback URB, interrupt handler add URB node to the bh->head list also. If check bh->head list again after finish all URB giveback of local_list, then it may introduce a "dynamic balance" between giveback URB and add URB to bh->head list. This tasklet callback function may not exit for a long time, which will cause other tasklet function calls to be delayed. Some real-time applications(such as KB and Mouse) will see noticeable lag.
In order to prevent the tasklet function from occupying the cpu for a long time at a time, new URBS will not be added to the local_list even though the bh->head list is not empty. But also need to ensure the left URB giveback to be processed in time, so add a member high_prio for structure giveback_urb_bh to prioritize tasklet and schelule this tasklet again if bh->head list is not empty.
At the same time, we are able to prioritize tasklet through structure member high_prio. So, replace the local high_prio_bh variable with this structure member in usb_hcd_giveback_urb.
--- drivers/usb/core/hcd.c | 26 +++++++++++++++----------- include/linux/usb/hcd.h | 1 + 2 files changed, 16 insertions(+), 11 deletions(-)
drivers/usb/core/hcd.c +15 -11
@@ -1803,7 +1803,6 @@ static void usb_giveback_urb_bh(unsignedspin_lock_irq (&bh->lock); bh->running = true; - restart:list_replace_init (&bh->head, &local_list);spin_unlock_irq (&bh->lock);
@@ -1817,10 +1816,17 @@ static void usb_giveback_urb_bh(unsigned bh->completing_ep =NULL ; } -/* check if there are new URBs to giveback */ +/* +* giveback new URBs next time to prevent this function +* from not exiting for a long time. +*/ spin_lock_irq (&bh->lock); -if (!list_empty (&bh->head)) - goto restart; +if (!list_empty (&bh->head)) { +if (bh->high_prio) +tasklet_hi_schedule (&bh->bh); +else +tasklet_schedule (&bh->bh); + } bh->running = false;spin_unlock_irq (&bh->lock); }
@@ -1845,7 +1851,7 @@ static void usb_giveback_urb_bh(unsignedvoid usb_hcd_giveback_urb (struct usb_hcd *hcd,struct urb *urb,int status) {struct giveback_urb_bh *bh; -bool running, high_prio_bh; +bool running;/* pass status to tasklet via unlinked */ if (likely (!urb->unlinked))
@@ -1856,13 +1862,10 @@ void usb_hcd_giveback_urb(struct usb_hcdreturn ; } -if (usb_pipeisoc (urb->pipe) ||usb_pipeint (urb->pipe)) { +if (usb_pipeisoc (urb->pipe) ||usb_pipeint (urb->pipe)) bh = &hcd->high_prio_bh; - high_prio_bh = true; - }else { +else bh = &hcd->low_prio_bh; - high_prio_bh = false; - }spin_lock (&bh->lock);list_add_tail (&urb->urb_list, &bh->head);
@@ -1871,7 +1874,7 @@ void usb_hcd_giveback_urb(struct usb_hcdif (running) ; -else if (high_prio_bh) +else if (bh->high_prio)tasklet_hi_schedule (&bh->bh);else tasklet_schedule (&bh->bh);
@@ -2880,6 +2883,7 @@ int usb_add_hcd(struct usb_hcd *hcd,/* initialize tasklets */ init_giveback_urb_bh (&hcd->high_prio_bh); + hcd->high_prio_bh.high_prio = true;init_giveback_urb_bh (&hcd->low_prio_bh);/* enable irqs just before we start the controller,
include/linux/usb/hcd.h +1 -0
@@ -65,6 +65,7 @@struct giveback_urb_bh {bool running; +bool high_prio;spinlock_t lock;struct list_head head;struct tasklet_struct bh;
Greg Kroah-Hartman
maintainerPATCH 46/101 netfilter: nf_tables: fix null deref due to zeroed list head
In reply to Greg Kroah-HartmanFrom: Florian Westphal <[email protected]>
commit 580077855a40741cf511766129702d97ff02f4d9 upstream.
In nf_tables_updtable, if nf_tables_table_enable returns an error, nft_trans_destroy is called to free the transaction object.
nft_trans_destroy() calls list_del(), but the transaction was never placed on a list -- the list head is all zeroes, this results in a null dereference:
BUG: KASAN: null-ptr-deref in nft_trans_destroy+0x26/0x59 Call Trace: nft_trans_destroy+0x26/0x59 nf_tables_newtable+0x4bc/0x9bc [..]
Its sane to assume that nft_trans_destroy() can be called on the transaction object returned by nft_trans_alloc(), so make sure the list head is initialised.
--- net/netfilter/nf_tables_api.c | 1 + 1 file changed, 1 insertion(+)
net/netfilter/nf_tables_api.c +1 -0
@@ -119,6 +119,7 @@ static struct nft_trans *nft_trans_allocif (trans ==NULL )return NULL ; +INIT_LIST_HEAD (&trans->list); trans->msg_type = msg_type; trans->ctx = *ctx;
Greg Kroah-Hartman
maintainerPATCH 47/101 scsi: zfcp: Fix missing auto port scan and thus missing target ports
In reply to Greg Kroah-HartmanFrom: Steffen Maier <[email protected]>
commit 4da8c5f76825269f28d6a89fa752934a4bcb6dfa upstream.
Case (1):
The only waiter on wka_port->completion_wq is zfcp_fc_wka_port_get() trying to open a WKA port. As such it should only be woken up by WKA port *open* responses, not by WKA port close responses.
Case (2):
A close WKA port response coming in just after having sent a new open WKA port request and before blocking for the open response with wait_event() in zfcp_fc_wka_port_get() erroneously renders the wait_event a NOP because the close handler overwrites wka_port->status. Hence the wait_event condition is erroneously true and it does not enter blocking state.
With non-negligible probability, the following time space sequence happens depending on timing without this fix:
user process ERP thread zfcp work queue tasklet system work queue
============ ========== =============== ======= =================
$ echo 1 > online
zfcp_ccw_set_online
zfcp_ccw_activate
zfcp_erp_adapter_reopen
msleep scan backoff zfcp_erp_strategy
| ...
| zfcp_erp_action_cleanup
| ...
| queue delayed scan_work
| queue ns_up_work
| ns_up_work:
| zfcp_fc_wka_port_get
| open wka request
| open response
| GSPN FC-GS
| RSPN FC-GS [NPIV-only]
| zfcp_fc_wka_port_put
| (--wka->refcount==0)
| sched delayed wka->work
|
~~~Case (1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
zfcp_erp_wait
flush scan_work
| wka->work:
| wka->status=CLOSING
| close wka request
| scan_work:
| zfcp_fc_wka_port_get
| (wka->status==CLOSING)
| wka->status=OPENING
| open wka request
| wait_event
| | close response
| | wka->status=OFFLINE
| | wake_up /*WRONG*/
~~~Case (2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| wka->work:
| wka->status=CLOSING
| close wka request
zfcp_erp_wait
flush scan_work
| scan_work:
| zfcp_fc_wka_port_get
| (wka->status==CLOSING)
| wka->status=OPENING
| open wka request
| close response
| wka->status=OFFLINE
| wake_up /*WRONG&NOP*/
| wait_event /*NOP*/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| (wka->status!=ONLINE)
| return -EIO
| return early
open response
wka->status=ONLINE
wake_up /*NOP*/So we erroneously end up with no automatic port scan. This is a big problem when it happens during boot. The timing is influenced by v3.19 commit 18f87a67e6d6 ("zfcp: auto port scan resiliency").
Fix it by fully mutually excluding zfcp_fc_wka_port_get() and zfcp_fc_wka_port_offline(). For that to work, we make the latter block until we got the response for a close WKA port. In order not to penalize the system workqueue, we move wka_port->work to our own adapter workqueue. Note that before v2.6.30 commit 828bc1212a68 ("[SCSI] zfcp: Set WKA-port to offline on adapter deactivation"), zfcp did block in zfcp_fc_wka_port_offline() as well, but with a different condition.
While at it, make non-functional cleanups to improve code reading in zfcp_fc_wka_port_get(). If we cannot send the WKA port open request, don't rely on the subsequent wait_event condition to immediately let this case pass without blocking. Also don't want to rely on the additional condition handling the refcount to be skipped just to finally return with -EIO.
--- drivers/s390/scsi/zfcp_fc.c | 29 ++++++++++++++++++++--------- drivers/s390/scsi/zfcp_fc.h | 6 ++++-- drivers/s390/scsi/zfcp_fsf.c | 4 ++-- 3 files changed, 26 insertions(+), 13 deletions(-)
drivers/s390/scsi/zfcp_fc.c +20 -9
@@ -144,27 +144,33 @@ void zfcp_fc_enqueue_event(struct zfcp_astatic int zfcp_fc_wka_port_get (struct zfcp_fc_wka_port *wka_port) { +int ret = -EIO ; +if (mutex_lock_interruptible (&wka_port->mutex))return -ERESTARTSYS ;if (wka_port->status ==ZFCP_FC_WKA_PORT_OFFLINE || wka_port->status ==ZFCP_FC_WKA_PORT_CLOSING ) { wka_port->status =ZFCP_FC_WKA_PORT_OPENING ; -if (zfcp_fsf_open_wka_port (wka_port)) +if (zfcp_fsf_open_wka_port (wka_port)) { +/* could not even send request, nothing to wait for */ wka_port->status =ZFCP_FC_WKA_PORT_OFFLINE ; + goto out; + } } -mutex_unlock (&wka_port->mutex); - -wait_event (wka_port->completion_wq, +wait_event (wka_port->opened, wka_port->status ==ZFCP_FC_WKA_PORT_ONLINE || wka_port->status ==ZFCP_FC_WKA_PORT_OFFLINE );if (wka_port->status ==ZFCP_FC_WKA_PORT_ONLINE ) {atomic_inc (&wka_port->refcount); -return 0 ; + ret =0 ; + goto out; } -return -EIO ; +out: +mutex_unlock (&wka_port->mutex); +return ret; }static void zfcp_fc_wka_port_offline (struct work_struct *work)
@@ -180,9 +186,12 @@ static void zfcp_fc_wka_port_offline(str wka_port->status =ZFCP_FC_WKA_PORT_CLOSING ;if (zfcp_fsf_close_wka_port (wka_port)) { +/* could not even send request, nothing to wait for */ wka_port->status =ZFCP_FC_WKA_PORT_OFFLINE ; -wake_up (&wka_port->completion_wq); + goto out; } +wait_event (wka_port->closed, + wka_port->status ==ZFCP_FC_WKA_PORT_OFFLINE ); out:mutex_unlock (&wka_port->mutex); }
@@ -192,13 +201,15 @@ static void zfcp_fc_wka_port_put(structif (atomic_dec_return (&wka_port->refcount) !=0 )return ;/* wait 10 milliseconds, other reqs might pop in */ -schedule_delayed_work (&wka_port->work,HZ /100 ); +queue_delayed_work (wka_port->adapter->work_queue, &wka_port->work, +msecs_to_jiffies (10 )); }static void zfcp_fc_wka_port_init (struct zfcp_fc_wka_port *wka_port,u32 d_id,struct zfcp_adapter *adapter) { -init_waitqueue_head (&wka_port->completion_wq); +init_waitqueue_head (&wka_port->opened); +init_waitqueue_head (&wka_port->closed); wka_port->adapter = adapter; wka_port->d_id = d_id;
drivers/s390/scsi/zfcp_fc.h +4 -2
@@ -169,7 +169,8 @@ enum zfcp_fc_wka_status {/** * struct zfcp_fc_wka_port - representation of well-known-address (WKA) FC port * @adapter: Pointer to adapter structure this WKA port belongs to -* @completion_wq: Wait for completion of open/close command +* @opened: Wait for completion of open command +* @closed: Wait for completion of close command * @status: Current status of WKA port * @refcount: Reference count to keep port open as long as it is in use * @d_id: FC destination id or well-known-address
@@ -179,7 +180,8 @@ enum zfcp_fc_wka_status {*/ struct zfcp_fc_wka_port {struct zfcp_adapter *adapter; -wait_queue_head_t completion_wq; +wait_queue_head_t opened; +wait_queue_head_t closed;enum zfcp_fc_wka_status status;atomic_t refcount;u32 d_id;
drivers/s390/scsi/zfcp_fsf.c +2 -2
@@ -1582,7 +1582,7 @@ static void zfcp_fsf_open_wka_port_handl wka_port->status =ZFCP_FC_WKA_PORT_ONLINE ; } out: -wake_up (&wka_port->completion_wq); +wake_up (&wka_port->opened); }/**
@@ -1640,7 +1640,7 @@ static void zfcp_fsf_close_wka_port_hand } wka_port->status =ZFCP_FC_WKA_PORT_OFFLINE ; -wake_up (&wka_port->completion_wq); +wake_up (&wka_port->closed); }/**
Greg Kroah-Hartman
maintainerPATCH 48/101 x86/olpc: fix logical not is only applied to the left hand side
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
commit 3a2ba42cbd0b669ce3837ba400905f93dd06c79f upstream.
The bitops compile-time optimization series revealed one more problem in olpc-xo1-sci.c:send_ebook_state(), resulted in GCC warnings:
arch/x86/platform/olpc/olpc-xo1-sci.c: In function 'send_ebook_state':arch/x86/platform/olpc/olpc-xo1-sci.c:83:63: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
83 | if (!!test_bit(SW_TABLET_MODE, ebook_switch_idev->sw) == state)
| ^~arch/x86/platform/olpc/olpc-xo1-sci.c:83:13: note: add parentheses around left hand side expression to silence this warning
Despite this code working as intended, this redundant double negation of boolean value, together with comparing to char with no explicit conversion to bool, makes compilers think the author made some unintentional logical mistakes here. Make it the other way around and negate the char instead to silence the warnings.
--- arch/x86/platform/olpc/olpc-xo1-sci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/platform/olpc/olpc-xo1-sci.c +1 -1
@@ -85,7 +85,7 @@ static void send_ebook_state(void)return ; } -if (!!test_bit (SW_TABLET_MODE , ebook_switch_idev->sw) == state) +if (test_bit (SW_TABLET_MODE , ebook_switch_idev->sw) == !!state)return ;/* Nothing new to report. */ input_report_switch (ebook_switch_idev,SW_TABLET_MODE , state);
Greg Kroah-Hartman
maintainerPATCH 49/101 spmi: trace: fix stack-out-of-bound access in SPMI tracing functions
In reply to Greg Kroah-HartmanFrom: David Collins <[email protected]>
commit 2af28b241eea816e6f7668d1954f15894b45d7e3 upstream.
trace_spmi_write_begin() and trace_spmi_read_end() both call memcpy() with a length of "len + 1". This leads to one extra byte being read beyond the end of the specified buffer. Fix this out-of-bound memory access by using a length of "len" instead.
Here is a KASAN log showing the issue:
BUG: KASAN: stack-out-of-bounds in trace_event_raw_event_spmi_read_end+0x1d0/0x234 Read of size 2 at addr ffffffc0265b7540 by task [email protected]/1314 ... Call trace: dump_backtrace+0x0/0x3e8 show_stack+0x2c/0x3c dump_stack_lvl+0xdc/0x11c print_address_description+0x74/0x384 kasan_report+0x188/0x268 kasan_check_range+0x270/0x2b0 memcpy+0x90/0xe8 trace_event_raw_event_spmi_read_end+0x1d0/0x234 spmi_read_cmd+0x294/0x3ac spmi_ext_register_readl+0x84/0x9c regmap_spmi_ext_read+0x144/0x1b0 [regmap_spmi] _regmap_raw_read+0x40c/0x754 regmap_raw_read+0x3a0/0x514 regmap_bulk_read+0x418/0x494 adc5_gen3_poll_wait_hs+0xe8/0x1e0 [qcom_spmi_adc5_gen3] ... __arm64_sys_read+0x4c/0x60 invoke_syscall+0x80/0x218 el0_svc_common+0xec/0x1c8 ...
addr ffffffc0265b7540 is located in stack of task [email protected]/1314 at offset 32 in frame:
adc5_gen3_poll_wait_hs+0x0/0x1e0 [qcom_spmi_adc5_gen3]
this frame has 1 object:
[32, 33) 'status'
Memory state around the buggy address:
ffffffc0265b7400: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
ffffffc0265b7480: 04 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 00 00
>ffffffc0265b7500: 00 00 00 00 f1 f1 f1 f1 01 f3 f3 f3 00 00 00 00
^
ffffffc0265b7580: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffffffc0265b7600: f1 f1 f1 f1 01 f2 07 f2 f2 f2 01 f3 00 00 00 00
==================================================================--- include/trace/events/spmi.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
include/trace/events/spmi.h +6 -6
@@ -20,15 +20,15 @@ TRACE_EVENT(spmi_write_begin,__field ( u8, sid ) __field ( u16, addr ) __field ( u8, len ) -__dynamic_array ( u8, buf, len +1 ) +__dynamic_array ( u8, buf, len ) ),TP_fast_assign ( __entry->opcode = opcode; __entry->sid = sid; __entry->addr = addr; - __entry->len = len +1 ; -memcpy (__get_dynamic_array (buf), buf, len +1 ); + __entry->len = len; +memcpy (__get_dynamic_array (buf), buf, len); ), TP_printk("opc=%d sid=%02d addr=0x%04x len=%d buf=0x[%*phD]",
@@ -91,7 +91,7 @@ TRACE_EVENT(spmi_read_end,__field ( u16, addr ) __field ( int, ret ) __field ( u8, len ) -__dynamic_array ( u8, buf, len +1 ) +__dynamic_array ( u8, buf, len ) ), TP_fast_assign(
@@ -99,8 +99,8 @@ TRACE_EVENT(spmi_read_end, __entry->sid = sid; __entry->addr = addr; __entry->ret = ret; - __entry->len = len +1 ; -memcpy (__get_dynamic_array (buf), buf, len +1 ); + __entry->len = len; +memcpy (__get_dynamic_array (buf), buf, len); ), TP_printk("opc=%d sid=%02d addr=0x%04x ret=%d len=%02d buf=0x[%*phD]",
Greg Kroah-Hartman
maintainerPATCH 50/101 ext4: add EXT4_INODE_HAS_XATTR_SPACE macro in xattr.h
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit 179b14152dcb6a24c3415200603aebca70ff13af upstream.
When adding an xattr to an inode, we must ensure that the inode_size is not less than EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. Otherwise, the end position may be greater than the start position, resulting in UAF.
--- fs/ext4/xattr.h | 13 +++++++++++++ 1 file changed, 13 insertions(+)
fs/ext4/xattr.h +13 -0
@@ -76,6 +76,19 @@ struct ext4_xattr_entry {#define EXT4_ZERO_XATTR_VALUE ((void *)-1) +/* +* If we want to add an xattr to the inode, we should make sure that +* i_extra_isize is not 0 and that the inode size is not less than +* EXT4_GOOD_OLD_INODE_SIZE + extra_isize + pad. +* EXT4_GOOD_OLD_INODE_SIZE extra_isize header entry pad data +* |--------------------------|------------|------|---------|---|-------| +*/ +#define EXT4_INODE_HAS_XATTR_SPACE (inode) \ + ((EXT4_I(inode)->i_extra_isize != 0) && \ + (EXT4_GOOD_OLD_INODE_SIZE + EXT4_I(inode)->i_extra_isize + \ + sizeof(struct ext4_xattr_ibody_header) + EXT4_XATTR_PAD <= \ + EXT4_INODE_SIZE((inode)->i_sb))) +struct ext4_xattr_info {int name_index;const char *name;
Greg Kroah-Hartman
maintainerPATCH 51/101 ext4: make sure ext4_append() always allocates new block
In reply to Greg Kroah-HartmanFrom: Lukas Czerner <[email protected]>
commit b8a04fe77ef1360fbf73c80fddbdfeaa9407ed1b upstream.
ext4_append() must always allocate a new block, otherwise we run the risk of overwriting existing directory block corrupting the directory tree in the process resulting in all manner of problems later on.
Add a sanity check to see if the logical block is already allocated and error out if it is.
--- fs/ext4/namei.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/ext4/namei.c +16 -0
@@ -51,6 +51,7 @@ static struct buffer_head *ext4_append(hstruct inode *inode, ext4_lblk_t *block) { + struct ext4_map_blocks map;struct buffer_head *bh;int err;
@@ -60,6 +61,21 @@ static struct buffer_head *ext4_append(hreturn ERR_PTR (-ENOSPC ); *block = inode->i_size >> inode->i_sb->s_blocksize_bits; + map.m_lblk = *block; + map.m_len =1 ; + +/* +* We're appending new directory block. Make sure the block is not +* allocated yet, otherwise we will end up corrupting the +* directory. +*/ + err =ext4_map_blocks (NULL , inode, &map,0 ); +if (err <0 ) +return ERR_PTR (err); +if (err) { +EXT4_ERROR_INODE (inode,"Logical block already allocated" ); +return ERR_PTR (-EFSCORRUPTED ); + } bh =ext4_bread (handle, inode, *block,EXT4_GET_BLOCKS_CREATE );if (IS_ERR (bh))
Greg Kroah-Hartman
maintainerPATCH 52/101 ext4: fix use-after-free in ext4_xattr_set_entry
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit 67d7d8ad99beccd9fe92d585b87f1760dc9018e3 upstream.
Hulk Robot reported a issue:
==================================================================
BUG: KASAN: use-after-free in ext4_xattr_set_entry+0x18ab/0x3500 Write of size 4105 at addr ffff8881675ef5f4 by task syz-executor.0/7092 CPU: 1 PID: 7092 Comm: syz-executor.0 Not tainted 4.19.90-dirty #17 Call Trace: [...] memcpy+0x34/0x50 mm/kasan/kasan.c:303 ext4_xattr_set_entry+0x18ab/0x3500 fs/ext4/xattr.c:1747 ext4_xattr_ibody_inline_set+0x86/0x2a0 fs/ext4/xattr.c:2205 ext4_xattr_set_handle+0x940/0x1300 fs/ext4/xattr.c:2386 ext4_xattr_set+0x1da/0x300 fs/ext4/xattr.c:2498 __vfs_setxattr+0x112/0x170 fs/xattr.c:149 __vfs_setxattr_noperm+0x11b/0x2a0 fs/xattr.c:180 __vfs_setxattr_locked+0x17b/0x250 fs/xattr.c:238 vfs_setxattr+0xed/0x270 fs/xattr.c:255 setxattr+0x235/0x330 fs/xattr.c:520 path_setxattr+0x176/0x190 fs/xattr.c:539 __do_sys_lsetxattr fs/xattr.c:561 [inline] __se_sys_lsetxattr fs/xattr.c:557 [inline] __x64_sys_lsetxattr+0xc2/0x160 fs/xattr.c:557 do_syscall_64+0xdf/0x530 arch/x86/entry/common.c:298 entry_SYSCALL_64_after_hwframe+0x44/0xa9 RIP: 0033:0x459fe9 RSP: 002b:00007fa5e54b4c08 EFLAGS: 00000246 ORIG_RAX: 00000000000000bd RAX: ffffffffffffffda RBX: 000000000051bf60 RCX: 0000000000459fe9 RDX: 00000000200003c0 RSI: 0000000020000180 RDI: 0000000020000140 RBP: 000000000051bf60 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000001009 R11: 0000000000000246 R12: 0000000000000000 R13: 00007ffc73c93fc0 R14: 000000000051bf60 R15: 00007fa5e54b4d80
[...]
==================================================================
Above issue may happen as follows:
-------------------------------------ext4_xattr_set
ext4_xattr_set_handle
ext4_xattr_ibody_find
>> s->end < s->base
>> no EXT4_STATE_XATTR
>> xattr_check_inode is not executed
ext4_xattr_ibody_set
ext4_xattr_set_entry
>> size_t min_offs = s->end - s->base
>> UAF in memcpy
we can easily reproduce this problem with the following commands:
mkfs.ext4 -F /dev/sda
mount -o debug_want_extra_isize=128 /dev/sda /mnt
touch /mnt/file
setfattr -n user.cat -v seq -s z 4096|tr -d '[:digit:]' /mnt/file
In ext4_xattr_ibody_find, we have the following assignment logic:
header = IHDR(inode, raw_inode)
= raw_inode + EXT4_GOOD_OLD_INODE_SIZE + i_extra_isize
is->s.base = IFIRST(header)
= header + sizeof(struct ext4_xattr_ibody_header)
is->s.end = raw_inode + s_inode_size
In ext4_xattr_set_entry
min_offs = s->end - s->base
= s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize -
sizeof(struct ext4_xattr_ibody_header)
last = s->first
free = min_offs - ((void *)last - s->base) - sizeof(__u32)
= s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - i_extra_isize -
sizeof(struct ext4_xattr_ibody_header) - sizeof(__u32)
In the calculation formula, all values except s_inode_size and i_extra_size are fixed values. When i_extra_size is the maximum value s_inode_size - EXT4_GOOD_OLD_INODE_SIZE, min_offs is -4 and free is -8. The value overflows. As a result, the preceding issue is triggered when memcpy is executed.
Therefore, when finding xattr or setting xattr, check whether there is space for storing xattr in the inode to resolve this issue.
--- fs/ext4/xattr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
fs/ext4/xattr.c +4 -2
@@ -1053,8 +1053,9 @@ int ext4_xattr_ibody_find(struct inode *struct ext4_inode *raw_inode;int error; -if (EXT4_I (inode)->i_extra_isize ==0 ) +if (!EXT4_INODE_HAS_XATTR_SPACE (inode))return 0 ; + raw_inode =ext4_raw_inode (&is->iloc); header =IHDR (inode, raw_inode); is->s.base = is->s.first =IFIRST (header);
@@ -1107,8 +1108,9 @@ static int ext4_xattr_ibody_set(handle_tstruct ext4_xattr_search *s = &is->s;int error; -if (EXT4_I (inode)->i_extra_isize ==0 ) +if (!EXT4_INODE_HAS_XATTR_SPACE (inode))return -ENOSPC ; + error =ext4_xattr_set_entry (i, s, inode);if (error)return error;
Greg Kroah-Hartman
maintainerPATCH 53/101 ext4: update s_overhead_clusters in the superblock during an on-line resize
In reply to Greg Kroah-HartmanFrom: Theodore Ts'o <[email protected]>
commit de394a86658ffe4e89e5328fd4993abfe41b7435 upstream.
When doing an online resize, the on-disk superblock on-disk wasn't updated. This means that when the file system is unmounted and remounted, and the on-disk overhead value is non-zero, this would result in the results of statfs(2) to be incorrect.
This was partially fixed by Commits 10b01ee92df5 ("ext4: fix overhead calculation to account for the reserved gdt blocks"), 85d825dbf489 ("ext4: force overhead calculation if the s_overhead_cluster makes no sense"), and eb7054212eac ("ext4: update the cached overhead value in the superblock").
However, since it was too expensive to forcibly recalculate the overhead for bigalloc file systems at every mount, this didn't fix the problem for bigalloc file systems. This commit should address the problem when resizing file systems with the bigalloc feature enabled.
--- fs/ext4/resize.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/resize.c +1 -0
@@ -1446,6 +1446,7 @@ static void ext4_update_super(struct sup* Update the fs overhead information */ ext4_calculate_overhead (sb); + es->s_overhead_clusters =cpu_to_le32 (sbi->s_overhead);if (test_opt (sb,DEBUG )) printk(KERN_DEBUG "EXT4-fs: added group %u:"
Greg Kroah-Hartman
maintainerPATCH 54/101 ext4: fix extent status tree race in writeback error recovery path
In reply to Greg Kroah-HartmanFrom: Eric Whitney <[email protected]>
commit 7f0d8e1d607c1a4fa9a27362a108921d82230874 upstream.
A race can occur in the unlikely event ext4 is unable to allocate a physical cluster for a delayed allocation in a bigalloc file system during writeback. Failure to allocate a cluster forces error recovery that includes a call to mpage_release_unused_pages(). That function removes any corresponding delayed allocated blocks from the extent status tree. If a new delayed write is in progress on the same cluster simultaneously, resulting in the addition of an new extent containing one or more blocks in that cluster to the extent status tree, delayed block accounting can be thrown off if that delayed write then encounters a similar cluster allocation failure during future writeback.
Write lock the i_data_sem in mpage_release_unused_pages() to fix this problem. Ext4's block/cluster accounting code for bigalloc relies on i_data_sem for mutual exclusion, as is found in the delayed write path, and the locking in mpage_release_unused_pages() is missing.
--- fs/ext4/inode.c | 7 +++++++ 1 file changed, 7 insertions(+)
fs/ext4/inode.c +7 -0
@@ -1659,7 +1659,14 @@ static void mpage_release_unused_pages(sext4_lblk_t start, last; start = index << (PAGE_SHIFT - inode->i_blkbits); last = end << (PAGE_SHIFT - inode->i_blkbits); + +/* +* avoid racing with extent status tree scans made by +* ext4_insert_delayed_block() +*/ +down_write (&EXT4_I (inode)->i_data_sem);ext4_es_remove_extent (inode, start, last - start +1 ); +up_write (&EXT4_I (inode)->i_data_sem); }pagevec_init (&pvec,0 );
Greg Kroah-Hartman
maintainerPATCH 55/101 ext4: correct max_inline_xattr_value_size computing
In reply to Greg Kroah-HartmanFrom: Baokun Li <[email protected]>
commit c9fd167d57133c5b748d16913c4eabc55e531c73 upstream.
If the ext4 inode does not have xattr space, 0 is returned in the get_max_inline_xattr_value_size function. Otherwise, the function returns a negative value when the inode does not contain EXT4_STATE_XATTR.
--- fs/ext4/inline.c | 3 +++ 1 file changed, 3 insertions(+)
fs/ext4/inline.c +3 -0
@@ -40,6 +40,9 @@ static int get_max_inline_xattr_value_sistruct ext4_inode *raw_inode;int free, min_offs; +if (!EXT4_INODE_HAS_XATTR_SPACE (inode)) +return 0 ; + min_offs =EXT4_SB (inode->i_sb)->s_inode_size -EXT4_GOOD_OLD_INODE_SIZE - EXT4_I(inode)->i_extra_isize -
Greg Kroah-Hartman
maintainerPATCH 56/101 dm raid: fix address sanitizer warning in raid_status
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 1fbeea217d8f297fe0e0956a1516d14ba97d0396 upstream.
There is this warning when using a kernel with the address sanitizer and running this testsuite:
https://gitlab.com/cki-project/kernel-tests/-/tree/main/storage/swraid/scsi_raid
==================================================================
BUG: KASAN: slab-out-of-bounds in raid_status+0x1747/0x2820 [dm_raid] Read of size 4 at addr ffff888079d2c7e8 by task lvcreate/13319 CPU: 0 PID: 13319 Comm: lvcreate Not tainted 5.18.0-0.rc3.<snip> #1 Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011 Call Trace: <TASK> dump_stack_lvl+0x6a/0x9c print_address_description.constprop.0+0x1f/0x1e0 print_report.cold+0x55/0x244 kasan_report+0xc9/0x100 raid_status+0x1747/0x2820 [dm_raid] dm_ima_measure_on_table_load+0x4b8/0xca0 [dm_mod] table_load+0x35c/0x630 [dm_mod] ctl_ioctl+0x411/0x630 [dm_mod] dm_ctl_ioctl+0xa/0x10 [dm_mod] __x64_sys_ioctl+0x12a/0x1a0 do_syscall_64+0x5b/0x80
The warning is caused by reading conf->max_nr_stripes in raid_status. The code in raid_status reads mddev->private, casts it to struct r5conf and reads the entry max_nr_stripes.
However, if we have different raid type than 4/5/6, mddev->private doesn't point to struct r5conf; it may point to struct r0conf, struct r1conf, struct r10conf or struct mpconf. If we cast a pointer to one of these structs to struct r5conf, we will be reading invalid memory and KASAN warns about it.
Fix this bug by reading struct r5conf only if raid type is 4, 5 or 6.
--- drivers/md/dm-raid.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-raid.c +1 -1
@@ -3173,7 +3173,7 @@ static void raid_status(struct dm_target {struct raid_set *rs = ti->private;struct mddev *mddev = &rs->md; -struct r5conf *conf = mddev->private; +struct r5conf *conf =rs_is_raid456 (rs) ? mddev->private :NULL ;int i, max_nr_stripes = conf ? conf->max_nr_stripes :0 ;bool array_in_sync;unsigned int raid_param_cnt =1 ;/* at least 1 for chunksize */
Greg Kroah-Hartman
maintainerPATCH 57/101 net_sched: cls_route: remove from list when handle is 0
In reply to Greg Kroah-HartmanFrom: Thadeu Lima de Souza Cascardo <[email protected]>
commit 9ad36309e2719a884f946678e0296be10f0bb4c1 upstream.
When a route filter is replaced and the old filter has a 0 handle, the old one won't be removed from the hashtable, while it will still be freed.
The test was there since before commit 1109c00547fc ("net: sched: RCU cls_route"), when a new filter was not allocated when there was an old one. The old filter was reused and the reinserting would only be necessary if an old filter was replaced. That was still wrong for the same case where the old handle was 0.
Remove the old filter from the list independently from its handle value.
This fixes CVE-2022-2588, also reported as ZDI-CAN-17440.
--- net/sched/cls_route.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/sched/cls_route.c +1 -1
@@ -534,7 +534,7 @@ static int route4_change(struct net *netrcu_assign_pointer (f->next, f1);rcu_assign_pointer (*fp, f); -if (fold && fold->handle && f->handle != fold->handle) { +if (fold) { th =to_hash (fold->handle); h =from_hash (fold->handle >>16 ); b =rtnl_dereference (head->table[th]);
Greg Kroah-Hartman
maintainerPATCH 58/101 btrfs: reject log replay if there is unsupported RO compat flag
In reply to Greg Kroah-HartmanFrom: Qu Wenruo <[email protected]>
commit dc4d31684974d140250f3ee612c3f0cab13b3146 upstream.
[BUG]
If we have a btrfs image with dirty log, along with an unsupported RO compatible flag:
log_root 30474240
...compat_flags 0x0compat_ro_flags 0x40000003
( FREE_SPACE_TREE | FREE_SPACE_TREE_VALID | unknown flag: 0x40000000 )
Then even if we can only mount it RO, we will still cause metadata update for log replay:
BTRFS info (device dm-1): flagging fs with big metadata feature BTRFS info (device dm-1): using free space tree
BTRFS info (device dm-1): has skinny extents
BTRFS info (device dm-1): start tree-log replay
This is definitely against RO compact flag requirement.
[CAUSE]
RO compact flag only forces us to do RO mount, but we will still do log replay for plain RO mount.
Thus this will result us to do log replay and update metadata.
This can be very problematic for new RO compat flag, for example older kernel can not understand v2 cache, and if we allow metadata update on RO mount and invalidate/corrupt v2 cache.
[FIX]
Just reject the mount unless rescue=nologreplay is provided:
BTRFS error (device dm-1): cannot replay dirty log with unsupport optional features (0x40000000), try rescue=nologreplay instead
We don't want to set rescue=nologreply directly, as this would make the end user to read the old data, and cause confusion.
Since the such case is really rare, we're mostly fine to just reject the mount with an error message, which also includes the proper workaround.
--- fs/btrfs/disk-io.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
fs/btrfs/disk-io.c +14 -0
@@ -2774,6 +2774,20 @@ int open_ctree(struct super_block *sb, err = -EINVAL ; goto fail_alloc; } +/* +* We have unsupported RO compat features, although RO mounted, we +* should not cause any metadata write, including log replay. +* Or we could screw up whatever the new feature requires. +*/ +if (unlikely (features &&btrfs_super_log_root (disk_super) && + !btrfs_test_opt (fs_info,NOLOGREPLAY ))) { +btrfs_err (fs_info, +"cannot replay dirty log with unsupported compat_ro features (0x%llx), try rescue=nologreplay" , + features); + err = -EINVAL ; + goto fail_alloc; + } + max_active = fs_info->thread_pool_size;
Greg Kroah-Hartman
maintainerPATCH 59/101 tcp: fix over estimation in sk_forced_mem_schedule()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit c4ee118561a0f74442439b7b5b486db1ac1ddfeb upstream.
sk_forced_mem_schedule() has a bug similar to ones fixed in commit 7c80b038d23e ("net: fix sk_wmem_schedule() and sk_rmem_schedule() errors")
While this bug has little chance to trigger in old kernels, we need to fix it before the following patch.
--- net/ipv4/tcp_output.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/ipv4/tcp_output.c +4 -3
@@ -2986,11 +2986,12 @@ begin_fwd:*/ void sk_forced_mem_schedule (struct sock *sk,int size) { -int amt; +int delta, amt; -if (size <= sk->sk_forward_alloc) + delta = size - sk->sk_forward_alloc; +if (delta <=0 )return ; - amt =sk_mem_pages (size); + amt =sk_mem_pages (delta); sk->sk_forward_alloc += amt *SK_MEM_QUANTUM ;sk_memory_allocated_add (sk, amt);
Greg Kroah-Hartman
maintainerPATCH 60/101 scsi: sg: Allow waiting for commands to complete on removed device
In reply to Greg Kroah-HartmanFrom: Tony Battersby <[email protected]>
commit 3455607fd7be10b449f5135c00dc306b85dc0d21 upstream.
When a SCSI device is removed while in active use, currently sg will immediately return -ENODEV on any attempt to wait for active commands that were sent before the removal. This is problematic for commands that use SG_FLAG_DIRECT_IO since the data buffer may still be in use by the kernel when userspace frees or reuses it after getting ENODEV, leading to corrupted userspace memory (in the case of READ-type commands) or corrupted data being sent to the device (in the case of WRITE-type commands). This has been seen in practice when logging out of a iscsi_tcp session, where the iSCSI driver may still be processing commands after the device has been marked for removal.
Change the policy to allow userspace to wait for active sg commands even when the device is being removed. Return -ENODEV only when there are no more responses to read.
--- drivers/scsi/sg.c | 57 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 34 insertions(+), 23 deletions(-)
drivers/scsi/sg.c +34 -23
@@ -196,7 +196,7 @@ static void sg_link_reserve(Sg_fd * sfp,static void sg_unlink_reserve (Sg_fd * sfp,Sg_request * srp);static Sg_fd *sg_add_sfp (Sg_device * sdp);static void sg_remove_sfp (struct kref *); -static Sg_request *sg_get_rq_mark (Sg_fd * sfp,int pack_id); +static Sg_request *sg_get_rq_mark (Sg_fd * sfp,int pack_id,bool *busy);static Sg_request *sg_add_request (Sg_fd * sfp);static int sg_remove_request (Sg_fd * sfp,Sg_request * srp);static Sg_device *sg_get_dev (int dev);
@@ -418,6 +418,7 @@ sg_read(struct file *filp, char __user *Sg_fd *sfp;Sg_request *srp;int req_pack_id =-1 ; +bool busy;sg_io_hdr_t *hp;struct sg_header *old_hdr =NULL ;int retval =0 ;
@@ -465,25 +466,19 @@ sg_read(struct file *filp, char __user * }else req_pack_id = old_hdr->pack_id; } - srp =sg_get_rq_mark (sfp, req_pack_id); + srp =sg_get_rq_mark (sfp, req_pack_id, &busy);if (!srp) {/* now wait on packet to arrive */ -if (atomic_read (&sdp->detaching)) { - retval = -ENODEV ; - goto free_old_hdr; - }if (filp->f_flags &O_NONBLOCK ) { retval = -EAGAIN ; goto free_old_hdr; } retval =wait_event_interruptible (sfp->read_wait, - (atomic_read (&sdp->detaching) || - (srp =sg_get_rq_mark (sfp, req_pack_id)))); -if (atomic_read (&sdp->detaching)) { - retval = -ENODEV ; - goto free_old_hdr; - } -if (retval) { -/* -ERESTARTSYS as signal hit process */ + ((srp =sg_get_rq_mark (sfp, req_pack_id, &busy)) || + (!busy &&atomic_read (&sdp->detaching)))); +if (!srp) { +/* signal or detaching */ +if (!retval) + retval = -ENODEV ; goto free_old_hdr; } }
@@ -936,9 +931,7 @@ sg_ioctl(struct file *filp, unsigned intif (result <0 )return result; result =wait_event_interruptible (sfp->read_wait, - (srp_done (sfp, srp) ||atomic_read (&sdp->detaching))); -if (atomic_read (&sdp->detaching)) -return -ENODEV ; +srp_done (sfp, srp));write_lock_irq (&sfp->rq_list_lock);if (srp->done) { srp->done =2 ;
@@ -2095,19 +2088,28 @@ sg_unlink_reserve(Sg_fd * sfp, Sg_reques }static Sg_request * -sg_get_rq_mark (Sg_fd * sfp,int pack_id) +sg_get_rq_mark (Sg_fd * sfp,int pack_id,bool *busy) {Sg_request *resp;unsigned long iflags; + *busy = false;write_lock_irqsave (&sfp->rq_list_lock, iflags);list_for_each_entry (resp, &sfp->rq_list, entry) { -/* look for requests that are ready + not SG_IO owned */ -if ((1 == resp->done) && (!resp->sg_io_owned) && +/* look for requests that are not SG_IO owned */ +if ((!resp->sg_io_owned) && ((-1 == pack_id) || (resp->header.pack_id == pack_id))) { - resp->done =2 ;/* guard against other readers */ -write_unlock_irqrestore (&sfp->rq_list_lock, iflags); -return resp; +switch (resp->done) { +case 0 :/* request active */ + *busy = true; +break ; +case 1 :/* request done; response ready to return */ + resp->done =2 ;/* guard against other readers */ +write_unlock_irqrestore (&sfp->rq_list_lock, iflags); +return resp; +case 2 :/* response already being returned */ +break ; + } } }write_unlock_irqrestore (&sfp->rq_list_lock, iflags);
@@ -2161,6 +2163,15 @@ sg_remove_request(Sg_fd * sfp, Sg_reques res =1 ; }write_unlock_irqrestore (&sfp->rq_list_lock, iflags); + +/* +* If the device is detaching, wakeup any readers in case we just +* removed the last response, which would leave nothing for them to +* return other than -ENODEV. +*/ +if (unlikely (atomic_read (&sfp->parentdp->detaching))) +wake_up_interruptible_all (&sfp->read_wait); +return res; }
Greg Kroah-Hartman
maintainerPATCH 61/101 Revert "net: usb: ax88179_178a needs FLAG_SEND_ZLP"
In reply to Greg Kroah-HartmanFrom: Jose Alonso <[email protected]>
commit 6fd2c17fb6e02a8c0ab51df1cfec82ce96b8e83d upstream.
This reverts commit 36a15e1cb134c0395261ba1940762703f778438c.
The usage of FLAG_SEND_ZLP causes problems to other firmware/hardware versions that have no issues.
The FLAG_SEND_ZLP is not safe to use in this context. See:
https://patchwork.ozlabs.org/project/netdev/patch/1270599787.8900.8.camel@Linuxdev4-laptop/#118378
The original problem needs another way to solve.
--- drivers/net/usb/ax88179_178a.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
drivers/net/usb/ax88179_178a.c +7 -7
@@ -1703,7 +1703,7 @@ static const struct driver_info ax88179_ .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1716,7 +1716,7 @@ static const struct driver_info ax88178a .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1729,7 +1729,7 @@ static const struct driver_info cypress_ .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1742,7 +1742,7 @@ static const struct driver_info dlink_du .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1755,7 +1755,7 @@ static const struct driver_info sitecom_ .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1768,7 +1768,7 @@ static const struct driver_info samsung_ .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
@@ -1781,7 +1781,7 @@ static const struct driver_info lenovo_i .link_reset = ax88179_link_reset, .reset = ax88179_reset, .stop = ax88179_stop, - .flags = FLAG_ETHER | FLAG_FRAMING_AX | FLAG_SEND_ZLP, + .flags = FLAG_ETHER | FLAG_FRAMING_AX, .rx_fixup = ax88179_rx_fixup, .tx_fixup = ax88179_tx_fixup, };
Greg Kroah-Hartman
maintainerPATCH 62/101 Bluetooth: L2CAP: Fix l2cap_global_chan_by_psm regression
In reply to Greg Kroah-HartmanFrom: Luiz Augusto von Dentz <[email protected]>
commit 332f1795ca202489c665a75e62e18ff6284de077 upstream.
The patch d0be8347c623: "Bluetooth: L2CAP: Fix use-after-free caused by l2cap_chan_put" from Jul 21, 2022, leads to the following Smatch static checker warning:
net/bluetooth/l2cap_core.c:1977 l2cap_global_chan_by_psm()
error: we previously assumed 'c' could be null (see line 1996)
--- net/bluetooth/l2cap_core.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-)
net/bluetooth/l2cap_core.c +6 -7
@@ -1804,11 +1804,11 @@ static struct l2cap_chan *l2cap_global_c bdaddr_t *dst, u8 link_type) { -struct l2cap_chan *c, *c1 =NULL ; +struct l2cap_chan *c, *tmp, *c1 =NULL ;read_lock (&chan_list_lock); -list_for_each_entry (c, &chan_list, global_l) { +list_for_each_entry_safe (c, tmp, &chan_list, global_l) {if (state && c->state != state)continue ;
@@ -1827,11 +1827,10 @@ static struct l2cap_chan *l2cap_global_c dst_match = !bacmp (&c->dst, dst);if (src_match && dst_match) { c =l2cap_chan_hold_unless_zero (c); -if (!c) -continue ; - -read_unlock (&chan_list_lock); -return c; +if (c) { +read_unlock (&chan_list_lock); +return c; + } }/* Closest match */
Greg Kroah-Hartman
maintainerPATCH 63/101 nios2: time: Read timer in get_cycles only if initialized
In reply to Greg Kroah-HartmanFrom: Guenter Roeck <[email protected]>
commit 65d1e3ddeae117f6a224535e10a09145f0f96508 upstream.
Mainline crashes as follows when running nios2 images.
On node 0 totalpages: 65536free_area_init_node: node 0, pgdat c8408fa0, node_mem_map c8726000
Normal zone: 512 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 65536 pages, LIFO batch:15
Unable to handle kernel NULL pointer dereference at virtual address 00000000 ea = c8003cb0, ra = c81cbf40, cause = 15 Kernel panic - not syncing: Oops
Problem is seen because get_cycles() is called before the timer it depends on is initialized. Returning 0 in that situation fixes the problem.
--- arch/nios2/kernel/time.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/nios2/kernel/time.c +4 -1
@@ -107,7 +107,10 @@ static struct nios2_clocksource nios2_cscycles_t get_cycles (void ) { -return nios2_timer_read (&nios2_cs.cs); +/* Only read timer if it has been initialized */ +if (nios2_cs.timer.base) +return nios2_timer_read (&nios2_cs.cs); +return 0 ; }EXPORT_SYMBOL (get_cycles);
Greg Kroah-Hartman
maintainerPATCH 64/101 net/9p: Initialize the iounit field during fid creation
In reply to Greg Kroah-HartmanFrom: Tyler Hicks <[email protected]>
commit aa7aeee169480e98cf41d83c01290a37e569be6d upstream.
Ensure that the fid's iounit field is set to zero when a new fid is created. Certain 9P operations, such as OPEN and CREATE, allow the server to reply with an iounit size which the client code assigns to the p9_fid struct shortly after the fid is created by p9_fid_create(). On the other hand, an XATTRWALK operation doesn't allow for the server to specify an iounit value. The iounit field of the newly allocated p9_fid struct remained uninitialized in that case. Depending on allocation patterns, the iounit value could have been something reasonable that was carried over from previously freed fids or, in the worst case, could have been arbitrary values from non-fid related usages of the memory location.
The bug was detected in the Windows Subsystem for Linux 2 (WSL2) kernel after the uninitialized iounit field resulted in the typical sequence of two getxattr(2) syscalls, one to get the size of an xattr and another after allocating a sufficiently sized buffer to fit the xattr value, to hit an unexpected ERANGE error in the second call to getxattr(2). An uninitialized iounit field would sometimes force rsize to be smaller than the xattr value size in p9_client_read_once() and the 9P server in WSL refused to chunk up the READ on the attr_fid and, instead, returned ERANGE to the client. The virtfs server in QEMU seems happy to chunk up the READ and this problem goes undetected there.
[tyhicks: Adjusted context due to:
- Lack of fid refcounting introduced in v5.11 commit 6636b6dcc3db ("9p:
add refcount to p9_fid struct")
- Difference in how buffer sizes are specified v5.16 commit 6e195b0f7c8e ("9p: fix a bunch of checkpatch warnings")
- Reimplementation of the fidlist as an IDR in v4.19 commit f28cdf0430fc ("9p: Replace the fidlist with an IDR")]
--- net/9p/client.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/9p/client.c +1 -3
@@ -891,7 +891,7 @@ static struct p9_fid *p9_fid_create(struunsigned long flags;p9_debug (P9_DEBUG_FID ,"clnt %p\n" , clnt); - fid =kmalloc (sizeof (struct p9_fid ),GFP_KERNEL ); + fid =kzalloc (sizeof (struct p9_fid ),GFP_KERNEL );if (!fid)return ERR_PTR (-ENOMEM );
@@ -902,11 +902,9 @@ static struct p9_fid *p9_fid_create(stru } fid->fid = ret; -memset (&fid->qid,0 ,sizeof (struct p9_qid )); fid->mode =-1 ; fid->uid =current_fsuid (); fid->clnt = clnt; - fid->rdir =NULL ;spin_lock_irqsave (&clnt->lock, flags);list_add (&fid->flist, &clnt->fidlist);spin_unlock_irqrestore (&clnt->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 65/101 net_sched: cls_route: disallow handle of 0
In reply to Greg Kroah-HartmanFrom: Jamal Hadi Salim <[email protected]>
commit 02799571714dc5dd6948824b9d080b44a295f695 upstream.
Follows up on:
https://lore.kernel.org/all/[email protected]/
handle of 0 implies from/to of universe realm which is not very sensible.
Lets see what this patch will do:
$sudo tc qdisc add dev $DEV root handle 1:0 prio
//lets manufacture a way to insert handle of 0
$sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 \
route to 0 from 0 classid 1:10 action ok
//gets rejected...
Error: handle of 0 is not valid.
We have an error talking to the kernel, -1
//lets create a legit entry..
sudo tc filter add dev $DEV parent 1:0 protocol ip prio 100 route from 10 \
classid 1:10 action ok
//what did the kernel insert?
$sudo tc filter ls dev $DEV parent 1:0
filter protocol ip pref 100 route chain 0
filter protocol ip pref 100 route chain 0 fh 0x000a8000 flowid 1:10 from 10
action order 1: gact action pass
random type none pass val 0
index 1 ref 1 bind 1
//Lets try to replace that legit entry with a handle of 0
$ sudo tc filter replace dev $DEV parent 1:0 protocol ip prio 100 \ handle 0x000a8000 route to 0 from 0 classid 1:10 action drop
Error: Replacing with handle of 0 is invalid.
We have an error talking to the kernel, -1
And last, lets run Cascardo's POC:
$ ./poc 0 0 -22 -22 -22
--- net/sched/cls_route.c | 6 ++++++ 1 file changed, 6 insertions(+)
net/sched/cls_route.c +6 -0
@@ -427,6 +427,9 @@ static int route4_set_parms(struct net * goto errout; } +if (!nhandle) +return -EINVAL ; + h1 =to_hash (nhandle); b =rtnl_dereference (head->table[h1]);if (!b) {
@@ -486,6 +489,9 @@ static int route4_change(struct net *netint err;bool new = true; +if (!handle) +return -EINVAL ; +if (opt ==NULL )return handle ? -EINVAL :0 ;
Greg Kroah-Hartman
maintainerPATCH 66/101 ALSA: info: Fix llseek return value when using callback
In reply to Greg Kroah-HartmanFrom: Amadeusz Sławiński <[email protected]>
commit 9be080edcca330be4af06b19916c35227891e8bc upstream.
When using callback there was a flow of
ret = -EINVAL
if (callback) {
offset = callback();
goto out;
}
...
offset = some other value in case of no callback;
ret = offset;
out:
return ret;which causes the snd_info_entry_llseek() to return -EINVAL when there is callback handler. Fix this by setting "ret" directly to callback return value before jumping to "out".
--- sound/core/info.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/core/info.c +3 -3
@@ -127,9 +127,9 @@ static loff_t snd_info_entry_llseek(stru entry = data->entry;mutex_lock (&entry->access);if (entry->c.ops->llseek) { - offset = entry->c.ops->llseek (entry, - data->file_private_data, - file, offset, orig); + ret = entry->c.ops->llseek (entry, + data->file_private_data, + file, offset, orig); goto out; }
Greg Kroah-Hartman
maintainerPATCH 67/101 rds: add missing barrier to release_refill
In reply to Greg Kroah-HartmanFrom: Mikulas Patocka <[email protected]>
commit 9f414eb409daf4f778f011cf8266d36896bb930b upstream.
The functions clear_bit and set_bit do not imply a memory barrier, thus it may be possible that the waitqueue_active function (which does not take any locks) is moved before clear_bit and it could miss a wakeup event.
Fix this bug by adding a memory barrier after clear_bit.
--- net/rds/ib_recv.c | 1 + 1 file changed, 1 insertion(+)
net/rds/ib_recv.c +1 -0
@@ -356,6 +356,7 @@ static int acquire_refill(struct rds_constatic void release_refill (struct rds_connection *conn) {clear_bit (RDS_RECV_REFILL , &conn->c_flags); +smp_mb__after_atomic ();/* We don't use wait_on_bit()/wake_up_bit() because our waking is in a * hot path and finding waiters is very rare. We don't want to walk
Greg Kroah-Hartman
maintainerPATCH 68/101 ata: libata-eh: Add missing command name
In reply to Greg Kroah-HartmanFrom: Damien Le Moal <[email protected]>
commit d3122bf9aa4c974f5e2c0112f799757b3a2779da upstream.
Add the missing command name for ATA_CMD_NCQ_NON_DATA to ata_get_cmd_name().
--- drivers/ata/libata-eh.c | 1 + 1 file changed, 1 insertion(+)
drivers/ata/libata-eh.c +1 -0
@@ -2439,6 +2439,7 @@ const char *ata_get_cmd_descript(u8 comm { ATA_CMD_WRITE_QUEUED_FUA_EXT, "WRITE DMA QUEUED FUA EXT" }, { ATA_CMD_FPDMA_READ, "READ FPDMA QUEUED" }, { ATA_CMD_FPDMA_WRITE, "WRITE FPDMA QUEUED" }, + { ATA_CMD_NCQ_NON_DATA, "NCQ NON-DATA" }, { ATA_CMD_FPDMA_SEND, "SEND FPDMA QUEUED" }, { ATA_CMD_FPDMA_RECV, "RECEIVE FPDMA QUEUED" }, { ATA_CMD_PIO_READ, "READ SECTOR(S)" },
Greg Kroah-Hartman
maintainerPATCH 69/101 btrfs: fix lost error handling when looking up extended ref on log replay
In reply to Greg Kroah-HartmanFrom: Filipe Manana <[email protected]>
commit 7a6b75b79902e47f46328b57733f2604774fa2d9 upstream.
During log replay, when processing inode references, if we get an error when looking up for an extended reference at __add_inode_ref(), we ignore it and proceed, returning success (0) if no other error happens after the lookup. This is obviously wrong because in case an extended reference exists and it encodes some name not in the log, we need to unlink it, otherwise the filesystem state will not match the state it had after the last fsync.
So just make __add_inode_ref() return an error it gets from the extended reference lookup.
--- fs/btrfs/tree-log.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
fs/btrfs/tree-log.c +3 -1
@@ -1074,7 +1074,9 @@ again: extref =btrfs_lookup_inode_extref (NULL , root, path, name, namelen, inode_objectid, parent_objectid,0 ,0 ); -if (!IS_ERR_OR_NULL (extref)) { +if (IS_ERR (extref)) { +return PTR_ERR (extref); + }else if (extref) {u32 item_size;u32 cur_offset =0 ;unsigned long base;
Greg Kroah-Hartman
maintainerPATCH 70/101 can: ems_usb: fix clangs -Wunaligned-access warning
In reply to Greg Kroah-HartmanFrom: Marc Kleine-Budde <[email protected]>
commit a4cb6e62ea4d36e53fb3c0f18ea4503d7b76674f upstream.
clang emits a -Wunaligned-access warning on struct __packed ems_cpc_msg.
The reason is that the anonymous union msg (not declared as packed) is being packed right after some non naturally aligned variables (3*8 bits + 2*32) inside a packed struct:
| struct __packed ems_cpc_msg {
| u8 type; /* type of message */
| u8 length; /* length of data within union 'msg' */
| u8 msgid; /* confirmation handle */
| __le32 ts_sec; /* timestamp in seconds */
| __le32 ts_nsec; /* timestamp in nano seconds */
| /* ^ not naturally aligned */
|
| union {
| /* ^ not declared as packed */
| u8 generic[64];
| struct cpc_can_msg can_msg;
| struct cpc_can_params can_params;
| struct cpc_confirm confirmation;
| struct cpc_overrun overrun;
| struct cpc_can_error error;
| struct cpc_can_err_counter err_counter;
| u8 can_state;
| } msg;
| };Starting from LLVM 14, having an unpacked struct nested in a packed struct triggers a warning. c.f. [1].
Fix the warning by marking the anonymous union as packed.
[1] https://github.com/llvm/llvm-project/issues/55520
--- drivers/net/can/usb/ems_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/usb/ems_usb.c +1 -1
@@ -206,7 +206,7 @@ struct __packed ems_cpc_msg {__le32 ts_sec;/* timestamp in seconds */ __le32 ts_nsec;/* timestamp in nano seconds */ -union { +union __packed {u8 generic[64 ];struct cpc_can_msg can_msg;struct cpc_can_params can_params;
Greg Kroah-Hartman
maintainerPATCH 71/101 NFSv4.1: RECLAIM_COMPLETE must handle EACCES
In reply to Greg Kroah-HartmanFrom: Zhang Xianwei <[email protected]>
commit e35a5e782f67ed76a65ad0f23a484444a95f000f upstream.
A client should be able to handle getting an EACCES error while doing a mount operation to reclaim state due to NFS4CLNT_RECLAIM_REBOOT being set. If the server returns RPC_AUTH_BADCRED because authentication failed when we execute "exportfs -au", then RECLAIM_COMPLETE will go a wrong way. After mount succeeds, all OPEN call will fail due to an NFS4ERR_GRACE error being returned. This patch is to fix it by resending a RPC request.
--- fs/nfs/nfs4proc.c | 3 +++ 1 file changed, 3 insertions(+)
fs/nfs/nfs4proc.c +3 -0
@@ -8229,6 +8229,9 @@ static int nfs41_reclaim_complete_handlerpc_delay (task,NFS4_POLL_RETRY_MAX );/* fall through */ case -NFS4ERR_RETRY_UNCACHED_REP : +case -EACCES : +dprintk ("%s: failed to reclaim complete error %d for server %s, retrying\n" , + __func__, task->tk_status, clp->cl_hostname);return -EAGAIN ;case -NFS4ERR_BADSESSION :case -NFS4ERR_DEADSESSION :
Greg Kroah-Hartman
maintainerPATCH 72/101 SUNRPC: Reinitialise the backchannel request buffers before reuse
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
commit 6622e3a73112fc336c1c2c582428fb5ef18e456a upstream.
When we're reusing the backchannel requests instead of freeing them, then we should reinitialise any values of the send/receive xdr_bufs so that they reflect the available space.
--- net/sunrpc/backchannel_rqst.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
net/sunrpc/backchannel_rqst.c +14 -0
@@ -69,6 +69,17 @@ static void xprt_free_allocation(structkfree (req); } +static void xprt_bc_reinit_xdr_buf (struct xdr_buf *buf) +{ + buf->head[0 ].iov_len =PAGE_SIZE ; + buf->tail[0 ].iov_len =0 ; + buf->pages =NULL ; + buf->page_len =0 ; + buf->flags =0 ; + buf->len =0 ; + buf->buflen =PAGE_SIZE ; +} +static int xprt_alloc_xdr_buf (struct xdr_buf *buf,gfp_t gfp_flags) {struct page *page;
@@ -291,6 +302,9 @@ void xprt_free_bc_rqst(struct rpc_rqst **/ spin_lock_bh (&xprt->bc_pa_lock);if (xprt_need_to_requeue (xprt)) { +xprt_bc_reinit_xdr_buf (&req->rq_snd_buf); +xprt_bc_reinit_xdr_buf (&req->rq_rcv_buf); + req->rq_rcv_buf.len =PAGE_SIZE ;list_add_tail (&req->rq_bc_pa_list, &xprt->bc_pa_list); xprt->bc_alloc_count++; req =NULL ;
Greg Kroah-Hartman
maintainerPATCH 73/101 pinctrl: nomadik: Fix refcount leak in nmk_pinctrl_dt_subnode_to_map
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
commit 4b32e054335ea0ce50967f63a7bfd4db058b14b9 upstream.
of_parse_phandle() returns a node pointer with refcount incremented, we should use of_node_put() on it when not need anymore. Add missing of_node_put() to avoid refcount leak."
--- drivers/pinctrl/nomadik/pinctrl-nomadik.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pinctrl/nomadik/pinctrl-nomadik.c +3 -1
@@ -1455,8 +1455,10 @@ static int nmk_pinctrl_dt_subnode_to_map has_config =nmk_pinctrl_dt_get_config (np, &configs); np_config =of_parse_phandle (np,"ste,config" ,0 ); -if (np_config) +if (np_config) { has_config |=nmk_pinctrl_dt_get_config (np_config, &configs); +of_node_put (np_config); + }if (has_config) {const char *gpio_name;const char *pin;
Greg Kroah-Hartman
maintainerPATCH 74/101 pinctrl: qcom: msm8916: Allow CAMSS GP clocks to be muxed
In reply to Greg Kroah-HartmanFrom: Nikita Travkin <[email protected]>
commit 44339391c666e46cba522d19c65a6ad1071c68b7 upstream.
GPIO 31, 32 can be muxed to GCC_CAMSS_GP(1,2)_CLK respectively but the function was never assigned to the pingroup (even though the function exists already).
Add this mode to the related pins.
--- drivers/pinctrl/qcom/pinctrl-msm8916.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/qcom/pinctrl-msm8916.c +2 -2
@@ -852,8 +852,8 @@ static const struct msm_pingroup msm8916PINGROUP (28 , pwr_modem_enabled_a,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b,NA , atest_combodac),PINGROUP (29 , cci_i2c,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b,NA , atest_combodac),PINGROUP (30 , cci_i2c,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b), -PINGROUP (31 , cci_timer0,NA ,NA ,NA ,NA ,NA ,NA ,NA ,NA ), -PINGROUP (32 , cci_timer1,NA ,NA ,NA ,NA ,NA ,NA ,NA ,NA ), +PINGROUP (31 , cci_timer0, flash_strobe,NA ,NA ,NA ,NA ,NA ,NA ,NA ), +PINGROUP (32 , cci_timer1, flash_strobe,NA ,NA ,NA ,NA ,NA ,NA ,NA ),PINGROUP (33 , cci_async,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b),PINGROUP (34 , pwr_nav_enabled_a,NA ,NA ,NA ,NA ,NA ,NA ,NA , qdss_tracedata_b), PINGROUP(35, pwr_crypto_enabled_a, NA, NA, NA, NA, NA, NA, NA, qdss_tracedata_b),
Greg Kroah-Hartman
maintainerPATCH 75/101 vsock: Fix memory leak in vsock_connect()
In reply to Greg Kroah-HartmanFrom: Peilin Ye <[email protected]>
commit 7e97cfed9929eaabc41829c395eb0d1350fccb9d upstream.
An O_NONBLOCK vsock_connect() request may try to reschedule @connect_work. Imagine the following sequence of vsock_connect() requests:
1. The 1st, non-blocking request schedules @connect_work, which will
expire after 200 jiffies. Socket state is now SS_CONNECTING;
2. Later, the 2nd, blocking request gets interrupted by a signal after a few jiffies while waiting for the connection to be established. Socket state is back to SS_UNCONNECTED, but @connect_work is still pending, and will expire after 100 jiffies.
3. Now, the 3rd, non-blocking request tries to schedule @connect_work again. Since @connect_work is already scheduled, schedule_delayed_work() silently returns. sock_hold() is called twice, but sock_put() will only be called once in vsock_connect_timeout(), causing a memory leak reported by syzbot:
BUG: memory leak
unreferenced object 0xffff88810ea56a40 (size 1232):
comm "syz-executor756", pid 3604, jiffies 4294947681 (age 12.350s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
28 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 (..@............
backtrace:
[<ffffffff837c830e>] sk_prot_alloc+0x3e/0x1b0 net/core/sock.c:1930
[<ffffffff837cbe22>] sk_alloc+0x32/0x2e0 net/core/sock.c:1989
[<ffffffff842ccf68>] __vsock_create.constprop.0+0x38/0x320 net/vmw_vsock/af_vsock.c:734
[<ffffffff842ce8f1>] vsock_create+0xc1/0x2d0 net/vmw_vsock/af_vsock.c:2203
[<ffffffff837c0cbb>] __sock_create+0x1ab/0x2b0 net/socket.c:1468
[<ffffffff837c3acf>] sock_create net/socket.c:1519 [inline]
[<ffffffff837c3acf>] __sys_socket+0x6f/0x140 net/socket.c:1561
[<ffffffff837c3bba>] __do_sys_socket net/socket.c:1570 [inline]
[<ffffffff837c3bba>] __se_sys_socket net/socket.c:1568 [inline]
[<ffffffff837c3bba>] __x64_sys_socket+0x1a/0x20 net/socket.c:1568
[<ffffffff84512815>] do_syscall_x64 arch/x86/entry/common.c:50 [inline]
[<ffffffff84512815>] do_syscall_64+0x35/0x80 arch/x86/entry/common.c:80
[<ffffffff84600068>] entry_SYSCALL_64_after_hwframe+0x44/0xae
<...>Use mod_delayed_work() instead: if @connect_work is already scheduled, reschedule it, and undo sock_hold() to keep the reference count balanced.
--- net/vmw_vsock/af_vsock.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/vmw_vsock/af_vsock.c +8 -1
@@ -1205,7 +1205,14 @@ static int vsock_stream_connect(struct s* timeout fires. */ sock_hold (sk); -schedule_delayed_work (&vsk->connect_work, timeout); + +/* If the timeout function is already scheduled, +* reschedule it, then ungrab the socket refcount to +* keep it balanced. +*/ +if (mod_delayed_work (system_wq, &vsk->connect_work, + timeout)) +sock_put (sk);/* Skip ahead to preserve error code set above. */ goto out_wait;
Greg Kroah-Hartman
maintainerPATCH 76/101 xen/xenbus: fix return type in xenbus_file_read()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 32ad11127b95236dfc52375f3707853194a7f4b4 upstream.
This code tries to store -EFAULT in an unsigned int. The xenbus_file_read() function returns type ssize_t so the negative value is returned as a positive value to the user.
This change forces another change to the min() macro. Originally, the min() macro used "unsigned" type which checkpatch complains about. Also unsigned type would break if "len" were not capped at MAX_RW_COUNT. Use size_t for the min(). (No effect on runtime for the min_t() change).
--- drivers/xen/xenbus/xenbus_dev_frontend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/xen/xenbus/xenbus_dev_frontend.c +2 -2
@@ -122,7 +122,7 @@ static ssize_t xenbus_file_read(struct f {struct xenbus_file_priv *u = filp->private_data;struct read_buffer *rb; -unsigned i; +ssize_t i;int ret;mutex_lock (&u->reply_mutex);
@@ -142,7 +142,7 @@ again: rb = list_entry(u->read_buffers.next, struct read_buffer, list); i =0 ;while (i < len) { -unsigned sz =min ((unsigned )len - i, rb->len - rb->cons); +size_t sz =min_t (size_t, len - i, rb->len - rb->cons); ret =copy_to_user (ubuf + i, &rb->msg[rb->cons], sz);
Greg Kroah-Hartman
maintainerPATCH 77/101 atm: idt77252: fix use-after-free bugs caused by tst_timer
In reply to Greg Kroah-HartmanFrom: Duoming Zhou <[email protected]>
commit 3f4093e2bf4673f218c0bf17d8362337c400e77b upstream.
There are use-after-free bugs caused by tst_timer. The root cause is that there are no functions to stop tst_timer in idt77252_exit(). One of the possible race conditions is shown below:
(thread 1) | (thread 2)
| idt77252_init_one
| init_card
| fill_tst
| mod_timer(&card->tst_timer, ...)
idt77252_exit | (wait a time)
| tst_timer
|
| ...
kfree(card) // FREE |
| card->soft_tst[e] // USEThe idt77252_dev is deallocated in idt77252_exit() and used in timer handler.
This patch adds del_timer_sync() in idt77252_exit() in order that the timer handler could be stopped before the idt77252_dev is deallocated.
--- drivers/atm/idt77252.c | 1 + 1 file changed, 1 insertion(+)
drivers/atm/idt77252.c +1 -0
@@ -3777,6 +3777,7 @@ static void __exit idt77252_exit(void) card = idt77252_chain; dev = card->atmdev; idt77252_chain = card->next; +del_timer_sync (&card->tst_timer);if (dev->phy->stop) dev->phy->stop (dev);
Greg Kroah-Hartman
maintainerPATCH 78/101 nios2: page fault et.al. are *not* restartable syscalls...
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 8535c239ac674f7ead0f2652932d35c52c4123b2 upstream.
make sure that ->orig_r2 is negative for everything except the syscalls.
--- arch/nios2/include/asm/entry.h | 3 ++- arch/nios2/kernel/entry.S | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-)
arch/nios2/include/asm/entry.h +2 -1
@@ -50,7 +50,8 @@ stw r13, PT_R13(sp) stw r14, PT_R14(sp) stw r15, PT_R15(sp) - stw r2, PT_ORIG_R2(sp) + movi r24, -1 + stw r24, PT_ORIG_R2(sp) stw r7, PT_ORIG_R7(sp) stw ra, PT_RA(sp)
arch/nios2/kernel/entry.S +1 -3
@@ -185,6 +185,7 @@ ENTRY(handle_system_call) ldw r5, PT_R5(sp) local_restart: + stw r2, PT_ORIG_R2(sp) /* Check that the requested system call is within limits */ movui r1, __NR_syscalls bgeu r2, r1, ret_invsyscall
@@ -336,9 +337,6 @@ external_interrupt: /* skip if no interrupt is pending */ beq r12, r0, ret_from_interrupt - movi r24, -1 - stw r24, PT_ORIG_R2(sp) - /* * Process an external hardware interrupt. */
Greg Kroah-Hartman
maintainerPATCH 79/101 nios2: dont leave NULLs in sys_call_table[]
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 45ec746c65097c25e77d24eae8fee0def5b6cc5d upstream.
fill the gaps in there with sys_ni_syscall, as everyone does...
--- arch/nios2/kernel/entry.S | 1 - arch/nios2/kernel/syscall_table.c | 1 + 2 files changed, 1 insertion(+), 1 deletion(-)
arch/nios2/kernel/entry.S +0 -1
@@ -193,7 +193,6 @@ local_restart: movhi r11, %hiadj(sys_call_table) add r1, r1, r11 ldw r1, %lo(sys_call_table)(r1) - beq r1, r0, ret_invsyscall /* Check if we are being traced */ GET_THREAD_INFO r11
arch/nios2/kernel/syscall_table.c +1 -0
@@ -25,5 +25,6 @@#define __SYSCALL (nr, call) [nr] = (call),void *sys_call_table[__NR_syscalls] = { + [0 ... __NR_syscalls-1 ] = sys_ni_syscall, #include <asm/unistd.h> };
Greg Kroah-Hartman
maintainerPATCH 80/101 nios2: traced syscall does need to check the syscall number
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 25ba820ef36bdbaf9884adeac69b6e1821a7df76 upstream.
all checks done before letting the tracer modify the register state are worthless...
--- arch/nios2/kernel/entry.S | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/nios2/kernel/entry.S +8 -3
@@ -255,9 +255,9 @@ traced_system_call: ldw r6, PT_R6(sp) ldw r7, PT_R7(sp) - /* Fetch the syscall function, we don't need to check the boundaries - * since this is already done. - */ + /* Fetch the syscall function. */ + movui r1, __NR_syscalls + bgeu r2, r1, traced_invsyscall slli r1, r2, 2 movhi r11,%hiadj(sys_call_table) add r1, r1, r11
@@ -287,6 +287,11 @@ end_translate_rc_and_ret2: RESTORE_SWITCH_STACK br ret_from_exception + /* If the syscall number was invalid return ENOSYS */ +traced_invsyscall: + movi r2, -ENOSYS + br translate_rc_and_ret2 + Luser_return: GET_THREAD_INFO r11 /* get thread_info pointer */ ldw r10, TI_FLAGS(r11) /* get thread_info->flags */
Greg Kroah-Hartman
maintainerPATCH 81/101 nios2: fix syscall restart checks
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 2d631bd58fe0ea3e3350212e23c9aba1fb606514 upstream.
sys_foo() returns -512 (aka -ERESTARTSYS) => do_signal() sees 512 in r2 and 1 in r1.
sys_foo() returns 512 => do_signal() sees 512 in r2 and 0 in r1.
The former is restart-worthy; the latter obviously isn't.
--- arch/nios2/kernel/signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/nios2/kernel/signal.c +1 -1
@@ -240,7 +240,7 @@ static int do_signal(struct pt_regs *reg/* * If we were from a system call, check for system call restarting... */ -if (regs->orig_r2 >=0 ) { +if (regs->orig_r2 >=0 && regs->r1) { continue_addr = regs->ea; restart_addr = continue_addr -4 ; retval = regs->r2;
Greg Kroah-Hartman
maintainerPATCH 82/101 nios2: restarts apply only to the first sigframe we build...
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit 411a76b7219555c55867466c82d70ce928d6c9e1 upstream.
--- arch/nios2/kernel/signal.c | 1 + 1 file changed, 1 insertion(+)
arch/nios2/kernel/signal.c +1 -0
@@ -261,6 +261,7 @@ static int do_signal(struct pt_regs *reg regs->ea = restart_addr;break ; } + regs->orig_r2 =-1 ; }if (get_signal (&ksig)) {
Greg Kroah-Hartman
maintainerPATCH 83/101 nios2: add force_successful_syscall_return()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
commit fd0c153daad135d0ec1a53c5dbe6936a724d6ae1 upstream.
If we use the ancient SysV syscall ABI, we'd better have tell the kernel how to claim that a negative return value is a success. Use ->orig_r2 for that - it's inaccessible via ptrace, so it's a fair game for changes and it's normally[*] non-negative on return from syscall. Set to -1; syscall is not going to be restart-worthy by definition, so we won't interfere with that use either.
[*] the only exception is rt_sigreturn(), where we skip the entire messing with r1/r2 anyway.
--- arch/nios2/include/asm/ptrace.h | 2 ++ arch/nios2/kernel/entry.S | 6 ++++++ 2 files changed, 8 insertions(+)
arch/nios2/include/asm/ptrace.h +2 -0
@@ -74,6 +74,8 @@ extern void show_regs(struct pt_regs *); ((struct pt_regs *)((unsigned long )current_thread_info () +THREAD_SIZE )\ - 1) +#define force_successful_syscall_return () (current_pt_regs()->orig_r2 = -1) +int do_syscall_trace_enter (void );void do_syscall_trace_exit (void );#endif /* __ASSEMBLY__ */
arch/nios2/kernel/entry.S +6 -0
@@ -213,6 +213,9 @@ local_restart: translate_rc_and_ret: movi r1, 0 bge r2, zero, 3f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 3f sub r2, zero, r2 movi r1, 1 3:
@@ -276,6 +279,9 @@ traced_system_call: translate_rc_and_ret2: movi r1, 0 bge r2, zero, 4f + ldw r1, PT_ORIG_R2(sp) + addi r1, r1, 1 + beq r1, zero, 4f sub r2, zero, r2 movi r1, 1 4:
Greg Kroah-Hartman
maintainerPATCH 84/101 netfilter: nf_tables: really skip inactive sets when allocating name
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
commit 271c5ca826e0c3c53e0eb4032f8eaedea1ee391c upstream.
While looping to build the bitmap of used anonymous set names, check the current set in the iteration, instead of the one that is being created.
--- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/netfilter/nf_tables_api.c +1 -1
@@ -2515,7 +2515,7 @@ cont:list_for_each_entry (i, &ctx->table->sets, list) {int tmp; -if (!nft_is_active_next (ctx->net, set)) +if (!nft_is_active_next (ctx->net, i))continue ;if (!sscanf (i->name, name, &tmp))continue ;
Greg Kroah-Hartman
maintainerPATCH 85/101 fec: Fix timer capture timing in `fec_ptp_enable_pps()`
In reply to Greg Kroah-HartmanFrom: Csókás Bence <[email protected]>
commit 61d5e2a251fb20c2c5e998c3f1d52ed6d5360319 upstream.
Code reimplements functionality already in fec_ptp_read(), but misses check for FEC_QUIRK_BUG_CAPTURE. Replace with function call.
--- drivers/net/ethernet/freescale/fec_ptp.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/net/ethernet/freescale/fec_ptp.c +1 -5
@@ -155,11 +155,7 @@ static int fec_ptp_enable_pps(struct fec* NSEC_PER_SEC - ts.tv_nsec. Add the remaining nanoseconds * to current timer would be next second. */ - tempval =readl (fep->hwp +FEC_ATIME_CTRL ); - tempval |=FEC_T_CTRL_CAPTURE ; -writel (tempval, fep->hwp +FEC_ATIME_CTRL ); - - tempval =readl (fep->hwp +FEC_ATIME ); + tempval = fep->cc.read (&fep->cc);/* Convert the ptp local counter to 1588 timestamp */ ns =timecounter_cyc2time (&fep->tc, tempval); ts =ns_to_timespec64 (ns);
Greg Kroah-Hartman
maintainerPATCH 86/101 kbuild: clear LDFLAGS in the top Makefile
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
commit ce99d0bf312daf0178e640da9e3c93b773a67e7d upstream.
Currently LDFLAGS is not cleared, so same flags are accumulated in LDFLAGS when the top Makefile is recursively invoked.
I found unneeded rebuild for ARCH=arm64 when CONFIG_TRIM_UNUSED_KSYMS is enabled. If include/generated/autoksyms.h is updated, the top Makefile is recursively invoked, then arch/arm64/Makefile adds one more '-maarch64linux'. Due to the command line change, modules are rebuilt needlessly.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -395,6 +395,7 @@ KBUILD_CFLAGS_KERNEL := KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds +LDFLAGS := GCC_PLUGINS_CFLAGS := CLANG_FLAGS :=
Greg Kroah-Hartman
maintainerPATCH 87/101 irqchip/tegra: Fix overflow implicit truncation warnings
In reply to Greg Kroah-HartmanFrom: Sai Prakash Ranjan <[email protected]>
[ Upstream commit 443685992bda9bb4f8b17fc02c9f6c60e62b1461 ]
Fix -Woverflow warnings for tegra irqchip driver which is a result of moving arm64 custom MMIO accessor macros to asm-generic function implementations giving a bonus type-checking now and uncovering these overflow warnings.
drivers/irqchip/irq-tegra.c: In function ‘tegra_ictlr_suspend’:drivers/irqchip/irq-tegra.c:151:18: warning: large integer implicitly truncated to unsigned type [-Woverflow]
writel_relaxed(~0ul, ictlr + ICTLR_COP_IER_CLR);
^--- drivers/irqchip/irq-tegra.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/irqchip/irq-tegra.c +5 -5
@@ -157,10 +157,10 @@ static int tegra_ictlr_suspend(void) lic->cop_iep[i] =readl_relaxed (ictlr +ICTLR_COP_IEP_CLASS );/* Disable COP interrupts */ -writel_relaxed (~0ul , ictlr +ICTLR_COP_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_COP_IER_CLR );/* Disable CPU interrupts */ -writel_relaxed (~0ul , ictlr +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_CPU_IER_CLR );/* Enable the wakeup sources of ictlr */ writel_relaxed (lic->ictlr_wake_mask[i], ictlr +ICTLR_CPU_IER_SET );
@@ -181,12 +181,12 @@ static void tegra_ictlr_resume(void)writel_relaxed (lic->cpu_iep[i], ictlr +ICTLR_CPU_IEP_CLASS ); -writel_relaxed (~0ul , ictlr +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_CPU_IER_CLR );writel_relaxed (lic->cpu_ier[i], ictlr +ICTLR_CPU_IER_SET );writel_relaxed (lic->cop_iep[i], ictlr +ICTLR_COP_IEP_CLASS ); -writel_relaxed (~0ul , ictlr +ICTLR_COP_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), ictlr +ICTLR_COP_IER_CLR );writel_relaxed (lic->cop_ier[i], ictlr +ICTLR_COP_IER_SET ); }
@@ -321,7 +321,7 @@ static int __init tegra_ictlr_init(struct device_node *node, lic->base[i] = base;/* Disable all interrupts */ -writel_relaxed (~0UL , base +ICTLR_CPU_IER_CLR ); +writel_relaxed (GENMASK (31 ,0 ), base +ICTLR_CPU_IER_CLR );/* All interrupts target IRQ */ writel_relaxed (0 , base +ICTLR_CPU_IEP_CLASS );
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 88/101 usb: host: ohci-ppc-of: Fix refcount leak bug
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 40a959d7042bb7711e404ad2318b30e9f92c6b9b ]
In ohci_hcd_ppc_of_probe(), of_find_compatible_node() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/usb/host/ohci-ppc-of.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/host/ohci-ppc-of.c +1 -0
@@ -168,6 +168,7 @@ static int ohci_hcd_ppc_of_probe(struct platform_device *op)release_mem_region (res.start,0x4 ); }else pr_debug ("%s: cannot get ehci offset from fdt\n" , __FILE__); +of_node_put (np); }irq_dispose_mapping (irq);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 89/101 gadgetfs: ep_io - wait until IRQ finishes
In reply to Greg Kroah-HartmanFrom: Jozef Martiniak <[email protected]>
[ Upstream commit 04cb742d4d8f30dc2e83b46ac317eec09191c68e ]
after usb_ep_queue() if wait_for_completion_interruptible() is interrupted we need to wait until IRQ gets finished.
Otherwise complete() from epio_complete() can corrupt stack.
--- drivers/usb/gadget/legacy/inode.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/legacy/inode.c +1 -0
@@ -365,6 +365,7 @@ ep_io (struct ep_data *epdata, void *buf, unsigned len)spin_unlock_irq (&epdata->dev->lock);DBG (epdata->dev,"endpoint gone\n" ); +wait_for_completion (&done); epdata->status = -ENODEV ; } }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 90/101 cxl: Fix a memory leak in an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 3a15b45b5454da862376b5d69a4967f5c6fa1368 ]
A bitmap_zalloc() must be balanced by a corresponding bitmap_free() in the error handling path of afu_allocate_irqs().
--- drivers/misc/cxl/irq.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/cxl/irq.c +1 -0
@@ -302,6 +302,7 @@ int afu_allocate_irqs(struct cxl_context *ctx, u32 count) out: cxl_ops->release_irq_ranges (&ctx->irqs, ctx->afu->adapter); +bitmap_free (ctx->irq_bitmap);afu_irq_name_free (ctx);return -ENOMEM ; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 91/101 drivers:md:fix a potential use-after-free bug
In reply to Greg Kroah-HartmanFrom: Wentao_Liang <[email protected]>
[ Upstream commit 104212471b1c1817b311771d817fb692af983173 ]
In line 2884, "raid5_release_stripe(sh);" drops the reference to sh and may cause sh to be released. However, sh is subsequently used in lines 2886 "if (sh->batch_head && sh != sh->batch_head)". This may result in an use-after-free bug.
It can be fixed by moving "raid5_release_stripe(sh);" to the bottom of the function.
--- drivers/md/raid5.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/raid5.c +1 -1
@@ -2513,10 +2513,10 @@ static void raid5_end_write_request(struct bio *bi)if (!test_and_clear_bit (R5_DOUBLE_LOCKED , &sh->dev[i].flags))clear_bit (R5_LOCKED , &sh->dev[i].flags);set_bit (STRIPE_HANDLE , &sh->state); -raid5_release_stripe (sh);if (sh->batch_head && sh != sh->batch_head)raid5_release_stripe (sh->batch_head); +raid5_release_stripe (sh); }static void raid5_build_block (struct stripe_head *sh,int i,int previous)
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 92/101 ext4: avoid remove directory when directory is corrupted
In reply to Greg Kroah-HartmanFrom: Ye Bin <[email protected]>
[ Upstream commit b24e77ef1c6d4dbf42749ad4903c97539cc9755a ]
Now if check directoy entry is corrupted, ext4_empty_dir may return true then directory will be removed when file system mounted with "errors=continue". In order not to make things worse just return false when directory is corrupted.
--- fs/ext4/namei.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
fs/ext4/namei.c +2 -5
@@ -2793,11 +2793,8 @@ bool ext4_empty_dir(struct inode *inode) de = (struct ext4_dir_entry_2 *) (bh->b_data + (offset & (sb->s_blocksize -1 )));if (ext4_check_dir_entry (inode,NULL , de, bh, - bh->b_data, bh->b_size, offset)) { - offset = (offset | (sb->s_blocksize -1 )) +1 ; -continue ; - } -if (le32_to_cpu (de->inode)) { + bh->b_data, bh->b_size, offset) || +le32_to_cpu (de->inode)) {brelse (bh);return false; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 93/101 ext4: avoid resizing to a partial cluster size
In reply to Greg Kroah-HartmanFrom: Kiselev, Oleg <[email protected]>
[ Upstream commit 69cb8e9d8cd97cdf5e293b26d70a9dee3e35e6bd ]
This patch avoids an attempt to resize the filesystem to an unaligned cluster boundary. An online resize to a size that is not integral to cluster size results in the last iteration attempting to grow the fs by a negative amount, which trips a BUG_ON and leaves the fs with a corrupted in-memory superblock.
--- fs/ext4/resize.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
fs/ext4/resize.c +10 -0
@@ -1941,6 +1941,16 @@ int ext4_resize_fs(struct super_block *sb, ext4_fsblk_t n_blocks_count) }brelse (bh); +/* +* For bigalloc, trim the requested size to the nearest cluster +* boundary to avoid creating an unusable filesystem. We do this +* silently, instead of returning an error, to avoid breaking +* callers that blindly resize the filesystem to the full size of +* the underlying block device. +*/ +if (ext4_has_feature_bigalloc (sb)) + n_blocks_count &= ~((1 <<EXT4_CLUSTER_BITS (sb)) -1 ); + retry: o_blocks_count =ext4_blocks_count (es);
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 94/101 tty: serial: Fix refcount leak bug in ucc_uart.c
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit d24d7bb2cd947676f9b71fb944d045e09b8b282f ]
In soc_info(), of_find_node_by_type() will return a node pointer with refcount incremented. We should use of_node_put() when it is not used anymore.
--- drivers/tty/serial/ucc_uart.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/tty/serial/ucc_uart.c +2 -0
@@ -1143,6 +1143,8 @@ static unsigned int soc_info(unsigned int *rev_h, unsigned int *rev_l)/* No compatible property, so try the name. */ soc_string = np->name; +of_node_put (np); +/* Extract the SOC number from the "PowerPC," string */ if ((sscanf (soc_string,"PowerPC,%u" , &soc) !=1 ) || !soc)return 0 ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 95/101 vfio: Clear the caps->buf to NULL after free
In reply to Greg Kroah-HartmanFrom: Schspa Shi <[email protected]>
[ Upstream commit 6641085e8d7b3f061911517f79a2a15a0a21b97b ]
On buffer resize failure, vfio_info_cap_add() will free the buffer, report zero for the size, and return -ENOMEM. As additional hardening, also clear the buffer pointer to prevent any chance of a double free.
--- drivers/vfio/vfio.c | 1 + 1 file changed, 1 insertion(+)
drivers/vfio/vfio.c +1 -0
@@ -1793,6 +1793,7 @@ struct vfio_info_cap_header *vfio_info_cap_add(struct vfio_info_cap *caps, buf =krealloc (caps->buf, caps->size + size,GFP_KERNEL );if (!buf) {kfree (caps->buf); + caps->buf =NULL ; caps->size =0 ;return ERR_PTR (-ENOMEM ); }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 96/101 mips: cavium-octeon: Fix missing of_node_put() in octeon2_usb_clocks_start
In reply to Greg Kroah-HartmanFrom: Liang He <[email protected]>
[ Upstream commit 7a9f743ceead60ed454c46fbc3085ee9a79cbebb ]
We should call of_node_put() for the reference 'uctl_node' returned by of_get_parent() which will increase the refcount. Otherwise, there will be a refcount leak bug.
--- arch/mips/cavium-octeon/octeon-platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/cavium-octeon/octeon-platform.c +2 -1
@@ -130,11 +130,12 @@ static void octeon2_usb_clocks_start(struct device *dev) "refclk-frequency", &clock_rate);if (i) {dev_err (dev,"No UCTL \"refclk-frequency\"\n" ); +of_node_put (uctl_node); goto exit; } i =of_property_read_string (uctl_node,"refclk-type" , &clock_type); - +of_node_put (uctl_node);if (!i &&strcmp ("crystal" , clock_type) ==0 ) is_crystal_clock = true; }
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 97/101 ALSA: core: Add async signal helpers
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit ef34a0ae7a2654bc9e58675e36898217fb2799d8 ]
Currently the call of kill_fasync() from an interrupt handler might lead to potential spin deadlocks, as spotted by syzkaller. Unfortunately, it's not so trivial to fix this lock chain as it's involved with the tasklist_lock that is touched in allover places.
As a temporary workaround, this patch provides the way to defer the async signal notification in a work. The new helper functions, snd_fasync_helper() and snd_kill_faync() are replacements for fasync_helper() and kill_fasync(), respectively. In addition, snd_fasync_free() needs to be called at the destructor of the relevant file object.
--- include/sound/core.h | 8 ++++ sound/core/misc.c | 94 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 102 insertions(+)
include/sound/core.h +8 -0
@@ -457,4 +457,12 @@ snd_pci_quirk_lookup_id(u16 vendor, u16 device, }#endif +/* async signal helpers */ +struct snd_fasync ; + +int snd_fasync_helper (int fd,struct file *file,int on, +struct snd_fasync **fasyncp); +void snd_kill_fasync (struct snd_fasync *fasync,int signal,int poll); +void snd_fasync_free (struct snd_fasync *fasync); +#endif /* __SOUND_CORE_H */
sound/core/misc.c +94 -0
103 lines not on this page · raw message
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 98/101 ALSA: timer: Use deferred fasync helper
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
[ Upstream commit 95cc637c1afd83fb7dd3d7c8a53710488f4caf9c ]
For avoiding the potential deadlock via kill_fasync() call, use the new fasync helpers to defer the invocation from PCI API. Note that it's merely a workaround.
--- sound/core/timer.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
sound/core/timer.c +6 -5
@@ -74,7 +74,7 @@ struct snd_timer_user {unsigned int filter;struct timespec tstamp;/* trigger tstamp */ wait_queue_head_t qchange_sleep; -struct fasync_struct *fasync; +struct snd_fasync *fasync;struct mutex ioctl_lock; };
@@ -1293,7 +1293,7 @@ static void snd_timer_user_interrupt(struct snd_timer_instance *timeri, } __wake:spin_unlock (&tu->qlock); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1330,7 +1330,7 @@ static void snd_timer_user_ccallback(struct snd_timer_instance *timeri,spin_lock_irqsave (&tu->qlock, flags);snd_timer_user_append_to_tqueue (tu, &r1);spin_unlock_irqrestore (&tu->qlock, flags); -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1397,7 +1397,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,spin_unlock (&tu->qlock);if (append ==0 )return ; -kill_fasync (&tu->fasync,SIGIO ,POLL_IN ); +snd_kill_fasync (tu->fasync,SIGIO ,POLL_IN );wake_up (&tu->qchange_sleep); }
@@ -1439,6 +1439,7 @@ static int snd_timer_user_release(struct inode *inode, struct file *file)if (tu->timeri)snd_timer_close (tu->timeri);mutex_unlock (&tu->ioctl_lock); +snd_fasync_free (tu->fasync);kfree (tu->queue);kfree (tu->tqueue);kfree (tu);
@@ -2026,7 +2027,7 @@ static int snd_timer_user_fasync(int fd, struct file * file, int on)struct snd_timer_user *tu; tu = file->private_data; -return fasync_helper (fd, file, on, &tu->fasync); +return snd_fasync_helper (fd, file, on, &tu->fasync); } static ssize_t snd_timer_user_read(struct file *file, char __user *buffer,
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 99/101 powerpc/64: Init jump labels before parse_early_param()
In reply to Greg Kroah-HartmanFrom: Zhouyi Zhou <[email protected]>
[ Upstream commit ca829e05d3d4f728810cc5e4b468d9ebc7745eb3 ]
On 64-bit, calling jump_label_init() in setup_feature_keys() is too late because static keys may be used in subroutines of parse_early_param() which is again subroutine of early_init_devtree().
For example booting with "threadirqs":
static_key_enable_cpuslocked(): static key '0xc000000002953260' used before call to jump_label_init()
WARNING: CPU: 0 PID: 0 at kernel/jump_label.c:166 static_key_enable_cpuslocked+0xfc/0x120
...
NIP static_key_enable_cpuslocked+0xfc/0x120
LR static_key_enable_cpuslocked+0xf8/0x120
Call Trace:
static_key_enable_cpuslocked+0xf8/0x120 (unreliable)
static_key_enable+0x30/0x50
setup_forced_irqthreads+0x28/0x40
do_early_param+0xa0/0x108
parse_args+0x290/0x4e0
parse_early_options+0x48/0x5c
parse_early_param+0x58/0x84
early_init_devtree+0xd4/0x518
early_setup+0xb4/0x214So call jump_label_init() just before parse_early_param() in early_init_devtree().
--- arch/powerpc/kernel/prom.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/powerpc/kernel/prom.c +7 -0
@@ -682,6 +682,13 @@ void __init early_init_devtree(void *params)of_scan_flat_dt (early_init_dt_scan_root,NULL );of_scan_flat_dt (early_init_dt_scan_memory_ppc,NULL ); +/* +* As generic code authors expect to be able to use static keys +* in early_param() handlers, we initialize the static keys just +* before parsing early params (it's fine to call jump_label_init() +* more than once). +*/ +jump_label_init ();parse_early_param ();/* make sure we've parsed cmdline for mem= before this */
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 100/101 video: fbdev: i740fb: Check the argument of i740_calc_vclk()
In reply to Greg Kroah-HartmanFrom: Zheyu Ma <[email protected]>
[ Upstream commit 40bf722f8064f50200b8c4f8946cd625b441dda9 ]
Since the user can control the arguments of the ioctl() from the user space, under special arguments that may result in a divide-by-zero bug.
If the user provides an improper 'pixclock' value that makes the argumet of i740_calc_vclk() less than 'I740_RFREQ_FIX', it will cause a divide-by-zero bug in:
drivers/video/fbdev/i740fb.c:353 p_best = min(15, ilog2(I740_MAX_VCO_FREQ / (freq / I740_RFREQ_FIX)));
The following log can reveal it:
divide error: 0000 [#1] PREEMPT SMP KASAN PTI
RIP: 0010:i740_calc_vclk drivers/video/fbdev/i740fb.c:353 [inline] RIP: 0010:i740fb_decode_var drivers/video/fbdev/i740fb.c:646 [inline] RIP: 0010:i740fb_set_par+0x163f/0x3b70 drivers/video/fbdev/i740fb.c:742 Call Trace: fb_set_var+0x604/0xeb0 drivers/video/fbdev/core/fbmem.c:1034 do_fb_ioctl+0x234/0x670 drivers/video/fbdev/core/fbmem.c:1110 fb_ioctl+0xdd/0x130 drivers/video/fbdev/core/fbmem.c:1189
Fix this by checking the argument of i740_calc_vclk() first.
--- drivers/video/fbdev/i740fb.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/video/fbdev/i740fb.c +7 -2
@@ -399,7 +399,7 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var,u32 xres, right, hslen, left, xtotal;u32 yres, lower, vslen, upper, ytotal;u32 vxres, xoffset, vyres, yoffset; -u32 bpp, base, dacspeed24, mem; +u32 bpp, base, dacspeed24, mem, freq;u8 r7;int i;
@@ -641,7 +641,12 @@ static int i740fb_decode_var(const struct fb_var_screeninfo *var, par->atc[VGA_ATC_OVERSCAN ] =0 ;/* Calculate VCLK that most closely matches the requested dot clock */ -i740_calc_vclk ((((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ), par); + freq = (((u32 )1e9 ) / var->pixclock) * (u32)(1e3 ); +if (freq <I740_RFREQ_FIX ) { +fb_dbg (info,"invalid pixclock\n" ); + freq =I740_RFREQ_FIX ; + } +i740_calc_vclk (freq, par);/* Since we program the clocks ourselves, always use VCLK2. */ par->misc |=0x0C ;
Signature · 1 line
2.35.1
Greg Kroah-Hartman
maintainerPATCH 101/101 MIPS: tlbex: Explicitly compare _PAGE_NO_EXEC against 0
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 74de14fe05dd6b151d73cb0c73c8ec874cbdcde6 ]
When CONFIG_XPA is enabled, Clang warns:
arch/mips/mm/tlbex.c:629:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (cpu_has_rixi && !!_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
arch/mips/mm/tlbex.c:2568:24: error: converting the result of '<<' to a boolean; did you mean '(1 << _PAGE_NO_EXEC_SHIFT) != 0'? [-Werror,-Wint-in-bool-context]
if (!cpu_has_rixi || !_PAGE_NO_EXEC) {
^
arch/mips/include/asm/pgtable-bits.h:174:28: note: expanded from macro '_PAGE_NO_EXEC'
# define _PAGE_NO_EXEC (1 << _PAGE_NO_EXEC_SHIFT)
^
2 errors generated._PAGE_NO_EXEC can be '0' or '1 << _PAGE_NO_EXEC_SHIFT' depending on the build and runtime configuration, which is what the negation operators are trying to convey. To silence the warning, explicitly compare against 0 so the result of the '<<' operator is not implicitly converted to a boolean.
According to its documentation, GCC enables -Wint-in-bool-context with -Wall but this warning is not visible when building the same configuration with GCC. It appears GCC only warns when compiling C++, not C, although the documentation makes no note of this:
https://godbolt.org/z/x39q3brxf
--- arch/mips/mm/tlbex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/mm/tlbex.c +2 -2
@@ -637,7 +637,7 @@ static __maybe_unused void build_convert_pte_to_entrylo(u32 **p,return ; } -if (cpu_has_rixi && !!_PAGE_NO_EXEC) { +if (cpu_has_rixi && _PAGE_NO_EXEC !=0 ) {if (fill_includes_sw_bits) {UASM_i_ROTR (p, reg, reg,ilog2 (_PAGE_GLOBAL)); }else {
@@ -2518,7 +2518,7 @@ static void check_pabits(void)unsigned long entry;unsigned pabits, fillbits; -if (!cpu_has_rixi || !_PAGE_NO_EXEC) { +if (!cpu_has_rixi || _PAGE_NO_EXEC ==0 ) {/* * We'll only be making use of the fact that we can rotate bits * into the fill if the CPU supports RIXI, so don't bother
Signature · 1 line
2.35.1
Hi!
Quoted 4 lines
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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.
This fails all over on ARM, with messages such as:
/builds/cip-project/cip-testing/linux-stable-rc-ci/gcc/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: error: source object drivers/net/ethernet/smsc/built-in.o has EABI version 5, but target drivers/net/ethernet/built-in.o has EABI version 0 2761/builds/cip-project/cip-testing/linux-stable-rc-ci/gcc/gcc-11.1.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-ld: failed to merge target specific data of file drivers/net/ethernet/smsc/built-in.o 2762scripts/Makefile.build:460: recipe for target 'drivers/net/ethernet/built-in.o' failed
2763make[3]: *** [drivers/net/ethernet/built-in.o] Error 1
2764
Which is quite an odd failure. (So I'm Ccing our testing people to ask for help).
https://gitlab.com/cip-project/cip-testing/linux-stable-rc-ci/-/jobs/2920073158
This looks vaguely related:
Quoted 2 lines
Masahiro Yamada <[email protected]>
kbuild: clear LDFLAGS in the topMakefile
Best regards,
Pavel
Signature · 2 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 164 pass: 141 fail: 23 Failed builds: arm:allmodconfig arm:imx_v6_v7_defconfig arm:ixp4xx_defconfig arm:u8500_defconfig arm:multi_v5_defconfig arm:omap1_defconfig arm:footbridge_defconfig arm:axm55xx_defconfig arm:keystone_defconfig arm:vexpress_defconfig arm:at91_dt_defconfig arm:shmobile_defconfig arm:nhk8815_defconfig arm:orion5x_defconfig arm:exynos_defconfig arm:cm_x2xx_defconfig arm:integrator_defconfig arm:pxa910_defconfig ia64:defconfig ia64:allnoconfig ia64:tinyconfig score:defconfig um:defconfig Qemu test results: total: 394 pass: 343 fail: 51 Failed tests: arm:versatilepb:versatile_defconfig:aeabi:pci:scsi:mem128:net,default:versatile-pb:rootfs arm:versatilepb:versatile_defconfig:aeabi:pci:mem128:net,default:versatile-pb:initrd arm:versatileab:versatile_defconfig:mem128:net,default:versatile-ab:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:mem128:exynos4210-smdkv310:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:sd2:mem128:exynos4210-smdkv310:rootfs arm:realview-pb-a8:realview_defconfig:realview_pb:mem512:net,default:arm-realview-pba8:initrd arm:realview-pbx-a9:realview_defconfig:realview_pb:net,default:arm-realview-pbx-a9:initrd arm:realview-eb:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb:initrd arm:realview-eb-mpcore:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb-11mp-ctrevb:initrd arm:akita:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:integratorcp:integrator_defconfig:mem128:net,default:integratorcp:initrd arm:integratorcp:integrator_defconfig:mem128:sd:net,default:integratorcp:rootfs mips:malta_defconfig:nocd:smp:net,e1000:initrd mips:malta_defconfig:nocd:smp:net,pcnet:flash,4,1,1:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:ide:rootfs mips:malta_defconfig:nocd:smp:net,e1000:usb-xhci:rootfs mips:malta_defconfig:nocd:smp:net,e1000-82545em:usb-uas-xhci:rootfs mips:malta_defconfig:nocd:smp:net,i82801:usb-ehci:rootfs mips:malta_defconfig:nocd:smp:net,ne2k_pci:sdhci:mmc:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:scsi[53C810]:rootfs mips:malta_defconfig:nocd:smp:net,rtl8139:scsi[53C895A]:rootfs mips:malta_defconfig:nocd:smp:net,tulip:scsi[DC395]:rootfs mips:malta_defconfig:nocd:smp:net,virtio-net:scsi[AM53C974]:rootfs mips:malta_defconfig:nocd:smp:net,i82550:scsi[MEGASAS]:rootfs mips:malta_defconfig:nocd:smp:net,i82558a:scsi[MEGASAS2]:rootfs mips:malta_defconfig:nocd:smp:net,i82562:scsi[FUSION]:rootfs mips:malta_defconfig:nocd:nosmp:net,e1000:initrd mips:malta_defconfig:nocd:nosmp:ide:net,pcnet:rootfs mipsel:mips32r6-generic:malta_32r6_defconfig:nocd:smp:net,pcnet:ide:rootfs sheb:rts7751r2dplus_defconfig:initrd sheb:rts7751r2dplus_defconfig:ata:rootfs xtensa:dc232b:lx60:generic_kc705_defconfig xtensa:dc232b:lx200:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc233c:ml605:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:de212:kc705-nommu:nommu_kc705_defconfig
Some change must have caused problems with the old binutils / linker version used when building v4.9.y kernels in my test bed.
Guenter
---
Build errors:
arm:
arm-linux-gnueabi-ld: error: source object drivers/net/ethernet/cirrus/built-in.o has EABI version 5, but target drivers/net/ethernet/built-in.o has EABI version 0
arm-linux-gnueabi-ld: failed to merge target specific data of file drivers/net/ethernet/cirrus/built-in.o
arm-linux-gnueabi-ld: error: source object drivers/net/ethernet/freescale/built-in.o has EABI version 5, but target drivers/net/ethernet/built-in.o has EABI version 0
arm-linux-gnueabi-ld: failed to merge target specific data of file drivers/net/ethernet/freescale/built-in.o
arm-linux-gnueabi-ld: error: source object drivers/net/ethernet/smsc/built-in.o has EABI version 5, but target drivers/net/ethernet/built-in.o has EABI version 0
arm-linux-gnueabi-ld: failed to merge target specific data of file drivers/net/ethernet/smsc/built-in.o
make[4]: *** [scripts/Makefile.build:460: drivers/net/ethernet/built-in.o] Error 1
make[3]: *** [scripts/Makefile.build:558: drivers/net/ethernet] Error 2
This affects a variety of files depending on the configuration.
ia64:
ia64-linux-ld: drivers/video/fbdev/omap2/built-in.o: linking constant-gp files with non-constant-gp files
ia64-linux-ld: failed to merge target specific data of file drivers/video/fbdev/omap2/built-in.o
ia64-linux-ld: drivers/gpu/vga/built-in.o: linking constant-gp files with non-constant-gp files
ia64-linux-ld: failed to merge target specific data of file drivers/gpu/vga/built-in.o
score:
Persistent compiler (or linker) error, resulting in core dump (gcc 4.9.1)
um:
Linker error, resulting in core dumps (gcc 6.3.0)
mips (qemu tests):
Yet another linker crash.
mips32r6-generic:
Error log:
mips-linux-ld: drivers/gpu/vga/built-in.o: linking mips:isa32r6 module with previous mips:3000 modules
mips-linux-ld: drivers/gpu/vga/built-in.o: linking -mnan=2008 module with previous -mnan=legacy modules
mips-linux-ld: failed to merge target specific data of file drivers/gpu/vga/built-in.o
sheb:
Another linker crash.
xtensa:
Again, linker crash
Quoted 90 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 164 pass: 141 fail: 23 Failed builds: arm:allmodconfig arm:imx_v6_v7_defconfig arm:ixp4xx_defconfig arm:u8500_defconfig arm:multi_v5_defconfig arm:omap1_defconfig arm:footbridge_defconfig arm:axm55xx_defconfig arm:keystone_defconfig arm:vexpress_defconfig arm:at91_dt_defconfig arm:shmobile_defconfig arm:nhk8815_defconfig arm:orion5x_defconfig arm:exynos_defconfig arm:cm_x2xx_defconfig arm:integrator_defconfig arm:pxa910_defconfig ia64:defconfig ia64:allnoconfig ia64:tinyconfig score:defconfig um:defconfig Qemu test results: total: 394 pass: 343 fail: 51 Failed tests: arm:versatilepb:versatile_defconfig:aeabi:pci:scsi:mem128:net,default:versatile-pb:rootfs arm:versatilepb:versatile_defconfig:aeabi:pci:mem128:net,default:versatile-pb:initrd arm:versatileab:versatile_defconfig:mem128:net,default:versatile-ab:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:mem128:exynos4210-smdkv310:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:sd2:mem128:exynos4210-smdkv310:rootfs arm:realview-pb-a8:realview_defconfig:realview_pb:mem512:net,default:arm-realview-pba8:initrd arm:realview-pbx-a9:realview_defconfig:realview_pb:net,default:arm-realview-pbx-a9:initrd arm:realview-eb:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb:initrd arm:realview-eb-mpcore:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb-11mp-ctrevb:initrd arm:akita:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:integratorcp:integrator_defconfig:mem128:net,default:integratorcp:initrd arm:integratorcp:integrator_defconfig:mem128:sd:net,default:integratorcp:rootfs mips:malta_defconfig:nocd:smp:net,e1000:initrd mips:malta_defconfig:nocd:smp:net,pcnet:flash,4,1,1:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:ide:rootfs mips:malta_defconfig:nocd:smp:net,e1000:usb-xhci:rootfs mips:malta_defconfig:nocd:smp:net,e1000-82545em:usb-uas-xhci:rootfs mips:malta_defconfig:nocd:smp:net,i82801:usb-ehci:rootfs mips:malta_defconfig:nocd:smp:net,ne2k_pci:sdhci:mmc:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:scsi[53C810]:rootfs mips:malta_defconfig:nocd:smp:net,rtl8139:scsi[53C895A]:rootfs mips:malta_defconfig:nocd:smp:net,tulip:scsi[DC395]:rootfs mips:malta_defconfig:nocd:smp:net,virtio-net:scsi[AM53C974]:rootfs mips:malta_defconfig:nocd:smp:net,i82550:scsi[MEGASAS]:rootfs mips:malta_defconfig:nocd:smp:net,i82558a:scsi[MEGASAS2]:rootfs mips:malta_defconfig:nocd:smp:net,i82562:scsi[FUSION]:rootfs mips:malta_defconfig:nocd:nosmp:net,e1000:initrd mips:malta_defconfig:nocd:nosmp:ide:net,pcnet:rootfs mipsel:mips32r6-generic:malta_32r6_defconfig:nocd:smp:net,pcnet:ide:rootfs sheb:rts7751r2dplus_defconfig:initrd sheb:rts7751r2dplus_defconfig:ata:rootfs xtensa:dc232b:lx60:generic_kc705_defconfig xtensa:dc232b:lx200:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc233c:ml605:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:de212:kc705-nommu:nommu_kc705_defconfig
Quoted 3 lines
Some change must have caused problems with the old binutils / linker version used when building v4.9.y kernels in my test bed.
Bisected with ia64 to commit 26f954a9e4e2 ("Makefile: link with -z noexecstack --no-warn-rwx-segments"). I did not test everything, but every build I did test passes with this patch reverted.
Guenter
Greg Kroah-Hartman
maintainerQuoted 91 lines · Guenter Roeck
Quoted 90 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
Build results:
total: 164 pass: 141 fail: 23 Failed builds: arm:allmodconfig arm:imx_v6_v7_defconfig arm:ixp4xx_defconfig arm:u8500_defconfig arm:multi_v5_defconfig arm:omap1_defconfig arm:footbridge_defconfig arm:axm55xx_defconfig arm:keystone_defconfig arm:vexpress_defconfig arm:at91_dt_defconfig arm:shmobile_defconfig arm:nhk8815_defconfig arm:orion5x_defconfig arm:exynos_defconfig arm:cm_x2xx_defconfig arm:integrator_defconfig arm:pxa910_defconfig ia64:defconfig ia64:allnoconfig ia64:tinyconfig score:defconfig um:defconfig Qemu test results: total: 394 pass: 343 fail: 51 Failed tests: arm:versatilepb:versatile_defconfig:aeabi:pci:scsi:mem128:net,default:versatile-pb:rootfs arm:versatilepb:versatile_defconfig:aeabi:pci:mem128:net,default:versatile-pb:initrd arm:versatileab:versatile_defconfig:mem128:net,default:versatile-ab:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:mem128:exynos4210-smdkv310:initrd arm:smdkc210:exynos_defconfig:cpuidle:nocrypto:sd2:mem128:exynos4210-smdkv310:rootfs arm:realview-pb-a8:realview_defconfig:realview_pb:mem512:net,default:arm-realview-pba8:initrd arm:realview-pbx-a9:realview_defconfig:realview_pb:net,default:arm-realview-pbx-a9:initrd arm:realview-eb:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb:initrd arm:realview-eb-mpcore:realview_defconfig:realview_eb:mem512:net,default:arm-realview-eb-11mp-ctrevb:initrd arm:akita:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:borzoi:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:spitz:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:net,usb:initrd arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:mmc:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:ata:net,usb:rootfs arm:terrier:pxa_defconfig:nodebug:nocd:nofs:nonvme:noscsi:notests:novirt:nofdt:usb:net,usb:rootfs arm:integratorcp:integrator_defconfig:mem128:net,default:integratorcp:initrd arm:integratorcp:integrator_defconfig:mem128:sd:net,default:integratorcp:rootfs mips:malta_defconfig:nocd:smp:net,e1000:initrd mips:malta_defconfig:nocd:smp:net,pcnet:flash,4,1,1:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:ide:rootfs mips:malta_defconfig:nocd:smp:net,e1000:usb-xhci:rootfs mips:malta_defconfig:nocd:smp:net,e1000-82545em:usb-uas-xhci:rootfs mips:malta_defconfig:nocd:smp:net,i82801:usb-ehci:rootfs mips:malta_defconfig:nocd:smp:net,ne2k_pci:sdhci:mmc:rootfs mips:malta_defconfig:nocd:smp:net,pcnet:scsi[53C810]:rootfs mips:malta_defconfig:nocd:smp:net,rtl8139:scsi[53C895A]:rootfs mips:malta_defconfig:nocd:smp:net,tulip:scsi[DC395]:rootfs mips:malta_defconfig:nocd:smp:net,virtio-net:scsi[AM53C974]:rootfs mips:malta_defconfig:nocd:smp:net,i82550:scsi[MEGASAS]:rootfs mips:malta_defconfig:nocd:smp:net,i82558a:scsi[MEGASAS2]:rootfs mips:malta_defconfig:nocd:smp:net,i82562:scsi[FUSION]:rootfs mips:malta_defconfig:nocd:nosmp:net,e1000:initrd mips:malta_defconfig:nocd:nosmp:ide:net,pcnet:rootfs mipsel:mips32r6-generic:malta_32r6_defconfig:nocd:smp:net,pcnet:ide:rootfs sheb:rts7751r2dplus_defconfig:initrd sheb:rts7751r2dplus_defconfig:ata:rootfs xtensa:dc232b:lx60:generic_kc705_defconfig xtensa:dc232b:lx200:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc232b:kc705:generic_kc705_defconfig xtensa:dc233c:ml605:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:dc233c:kc705:generic_kc705_defconfig xtensa:de212:kc705-nommu:nommu_kc705_defconfig
Quoted 7 lines
Quoted 3 lines
Some change must have caused problems with the old binutils / linker version used when building v4.9.y kernels in my test bed.
Bisected with ia64 to commit
26f954a9e4e2("Makefile: link with -z noexecstack --no-warn-rwx-segments"). I did not test everything, but every build I did test passes with this patch reverted.
Ick, I was trying to fix up builds with newer binutils. Seems to have worked for 4.14.y, but not 4.9.y. I'll go revert the above commit, and 2 others, and push out a -rc2.
thanks for testing and letting me know.
greg k-h
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.326-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.9.326 release. There are 101 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 Thu, 25 Aug 2022 08:00:15 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.326-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.9.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro's test farm.
Regressions on arm and mips build failure.
Build failure logs are the same other reports.
## Build
* kernel: 4.9.326-rc1
* git: https://gitlab.com/Linaro/lkft/mirrors/stable/linux-stable-rc
* git branch: linux-4.9.y
* git commit: 310ef13ccc72259d4df1c9fabbd5b5f8b7bf5563
* git describe: v4.9.325-102-g310ef13ccc72
* test details:
https://qa-reports.linaro.org/lkft/linux-stable-rc-linux-4.9.y/build/v4.9.325-102-g310ef13ccc72
## Test Regressions (compared to v4.9.325)
* arm, build
- clang-11-at91_dt_defconfig
- clang-11-axm55xx_defconfig
- clang-11-exynos_defconfig
- clang-11-integrator_defconfig
- clang-11-keystone_defconfig
- clang-11-multi_v5_defconfig
- clang-11-nhk8815_defconfig
- clang-11-omap1_defconfig
- clang-11-orion5x_defconfig
- clang-11-pxa910_defconfig
- clang-11-shmobile_defconfig
- clang-11-u8500_defconfig
- clang-11-vexpress_defconfig
- clang-12-at91_dt_defconfig
- clang-12-axm55xx_defconfig
- clang-12-exynos_defconfig
- clang-12-integrator_defconfig
- clang-12-keystone_defconfig
- clang-12-multi_v5_defconfig
- clang-12-nhk8815_defconfig
- clang-12-omap1_defconfig
- clang-12-orion5x_defconfig
- clang-12-pxa910_defconfig
- clang-12-shmobile_defconfig
- clang-12-u8500_defconfig
- clang-12-vexpress_defconfig
- clang-13-at91_dt_defconfig
- clang-13-axm55xx_defconfig
- clang-13-exynos_defconfig
- clang-13-integrator_defconfig
- clang-13-keystone_defconfig
- clang-13-multi_v5_defconfig
- clang-13-nhk8815_defconfig
- clang-13-omap1_defconfig
- clang-13-orion5x_defconfig
- clang-13-pxa910_defconfig
- clang-13-shmobile_defconfig
- clang-13-u8500_defconfig
- clang-13-vexpress_defconfig
- clang-14-multi_v5_defconfig-45747f0c
- clang-nightly-at91_dt_defconfig
- clang-nightly-axm55xx_defconfig
- clang-nightly-exynos_defconfig
- clang-nightly-integrator_defconfig
- clang-nightly-keystone_defconfig
- clang-nightly-multi_v5_defconfig
- clang-nightly-multi_v5_defconfig-45747f0c
- clang-nightly-nhk8815_defconfig
- clang-nightly-omap1_defconfig
- clang-nightly-orion5x_defconfig
- clang-nightly-pxa910_defconfig
- clang-nightly-shmobile_defconfig
- clang-nightly-u8500_defconfig
- clang-nightly-vexpress_defconfig
- gcc-10-at91_dt_defconfig
- gcc-10-axm55xx_defconfig
- gcc-10-exynos_defconfig
- gcc-10-footbridge_defconfig
- gcc-10-imx_v6_v7_defconfig
- gcc-10-integrator_defconfig
- gcc-10-ixp4xx_defconfig
- gcc-10-keystone_defconfig
- gcc-10-multi_v5_defconfig
- gcc-10-nhk8815_defconfig
- gcc-10-omap1_defconfig
- gcc-10-orion5x_defconfig
- gcc-10-pxa910_defconfig
- gcc-10-shmobile_defconfig
- gcc-10-u8500_defconfig
- gcc-10-vexpress_defconfig
- gcc-11-at91_dt_defconfig
- gcc-11-axm55xx_defconfig
- gcc-11-exynos_defconfig
- gcc-11-footbridge_defconfig
- gcc-11-imx_v6_v7_defconfig
- gcc-11-integrator_defconfig
- gcc-11-ixp4xx_defconfig
- gcc-11-keystone_defconfig
- gcc-11-multi_v5_defconfig
- gcc-11-multi_v5_defconfig-45747f0c
- gcc-11-nhk8815_defconfig
- gcc-11-omap1_defconfig
- gcc-11-orion5x_defconfig
- gcc-11-pxa910_defconfig
- gcc-11-shmobile_defconfig
- gcc-11-u8500_defconfig
- gcc-11-vexpress_defconfig
- gcc-9-at91_dt_defconfig
- gcc-9-axm55xx_defconfig
- gcc-9-exynos_defconfig
- gcc-9-footbridge_defconfig
- gcc-9-imx_v6_v7_defconfig
- gcc-9-integrator_defconfig
- gcc-9-ixp4xx_defconfig
- gcc-9-keystone_defconfig
- gcc-9-multi_v5_defconfig
- gcc-9-nhk8815_defconfig
- gcc-9-omap1_defconfig
- gcc-9-orion5x_defconfig
- gcc-9-pxa910_defconfig
- gcc-9-shmobile_defconfig
- gcc-9-u8500_defconfig
- gcc-9-vexpress_defconfig
* mips, build
- gcc-8-cavium_octeon_defconfig
--
Linaro LKFT
https://lkft.linaro.org