Commit graph

1,481,701 commits

Author SHA1 Message Date
Randy Dunlap
43598807f7 IB/mad: cleanup all kernel-doc comments
Add a leading "struct" keyword to struct descriptions:
Warning: ../include/uapi/rdma/ib_user_mad.h:72 cannot understand function prototype: 'struct ib_user_mad_hdr_old'
Warning: ../include/uapi/rdma/ib_user_mad.h:116 cannot understand function prototype: 'struct ib_user_mad_hdr'
Warning: ../include/uapi/rdma/ib_user_mad.h:143 cannot understand function prototype: 'struct ib_user_mad'
Warning: ../include/uapi/rdma/ib_user_mad.h:184 cannot understand function prototype: 'struct ib_user_mad_reg_req'
Warning: ../include/uapi/rdma/ib_user_mad.h:216 cannot understand function prototype: 'enum'

One enum and #define are moved out of line so that the struct description
and the struct block are not split (separated).

When this is done, more warnings are exposed:
Warning: include/uapi/rdma/ib_user_mad.h:89 struct member 'length' not described in 'ib_user_mad_hdr_old'
Warning: include/uapi/rdma/ib_user_mad.h:135 struct member 'length' not described in 'ib_user_mad_hdr'
Warning: include/uapi/rdma/ib_user_mad.h:135 struct member 'reserved' not described in 'ib_user_mad_hdr'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'id' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'qpn' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'mgmt_class' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'mgmt_class_version' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'res' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'flags' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'method_mask' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'oui' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'rmpp_version' not described in 'ib_user_mad_reg_req2'
Warning: include/uapi/rdma/ib_user_mad.h:227 struct member 'reserved' not described in 'ib_user_mad_reg_req2'

These are all repaired by using ':' as the separator between the struct
member @name and its description (instead of '-').

Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Link: https://patch.msgid.link/20260728183403.1136827-1-rdunlap@infradead.org
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2026-07-30 06:50:32 -04:00
Abd-Alrhman Masalkhi
3fe5b7c9fb md: remove REQ_NOWAIT support from raid1/10/456
REQ_NOWAIT support in md personalities that can block internally is
fundamentally incomplete. While reads can avoid some blocking paths,
write requests can still encounter cases where one mirror succeeds while
another returns -EAGAIN. At that point md cannot distinguish queue
pressure from a real device failure, so it can neither record a bad
block nor safely retry the write without REQ_NOWAIT, leaving mirrors
with divergent data.

Rather than continue advertising REQ_NOWAIT support for personalities
that cannot implement it correctly, remove it from raid1, raid10 and
raid456. Keep REQ_NOWAIT for linear and raid0, which only remap bios to
their underlying devices; stacked limits will still clear the feature if
any component device lacks REQ_NOWAIT support.

Fixes: bf2c411bb1 ("md: raid456 add nowait support")
Fixes: c9aa889b03 ("md: raid10 add nowait support")
Fixes: 5aa705039c ("md: raid1 add nowait support")
Fixes: f51d46d0e7 ("md: add support for REQ_NOWAIT")
Suggested-by: Yu Kuai <yukuai@fygo.io>
Signed-off-by: Abd-Alrhman Masalkhi <abd.masalkhi@gmail.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Link: https://patch.msgid.link/20260628142737.1051059-1-abd.masalkhi@gmail.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
2026-07-30 18:46:32 +08:00
Jan Kara
62333e480d udf: Fix data loss when converting inline inodes to out of line
When udf_expand_file_adinicb() converts file from inline format to out
of line, we use filemap_fdatawrite() to writeout the data to the new
blocks. However since 36580ed087 ("udf: Do not allocate blocks on page
writeback") the writeback actually doesn't allocate the new block and
the folio dirty bit is just silently cleared. Thus unless the file is
written to after the conversion (as it can easily happen in case of
truncate up), the data is just lost. Fix the problem by explicitely
allocating the block underlying the data before starting writeback.

Fixes: 36580ed087 ("udf: Do not allocate blocks on page writeback")
CC: stable@vger.kernel.org
Link: https://patch.msgid.link/20260730104232.4086759-4-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
2026-07-30 12:44:42 +02:00
Jan Kara
97e9d759a4 udf: Move udf_map_block() up
Move udf_map_block() in the file to avoid forward declarations.

Link: https://patch.msgid.link/20260730104232.4086759-3-jack@suse.cz
Signed-off-by: Jan Kara <jack@suse.cz>
2026-07-30 12:44:42 +02:00
Thomas Weißschuh
b9fc5a1742 tools/nolibc/powerpc: mark ctr and xer as clobbered by system call
The system call can clobber the ctr and xer registers.

Make sure the compiler takes this into account.

The missing clobbers only seem to be an issue with newer compilers.

Fixes: 0cb0675ec3 ("tools/nolibc: add support for powerpc")
Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
Link: https://patch.msgid.link/20260727-nolibc-powerpc-clobber-v1-1-e0911cc99ce1@linutronix.de
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
2026-07-30 12:44:07 +02:00
Jiawen Wu
732ed8f75c net: libwx: fix FDIR ATR queue mismatch for software VLAN packets
When TX VLAN hardware offload is disabled, VLAN tags are embedded in
the packet payload (software VLAN). Previously, the driver failed to
set the WX_TX_FLAGS_SW_VLAN flag for these packets during transmission.

This missing flag caused the txgbe FDIR ATR logic to fall through to the
default hash calculation path. This resulted in asymmetric hash values
for Tx and Rx flows, preventing return packets from being steered to the
same queue as the transmit packets.

Fix this by detecting software VLANs via eth_type_vlan(skb->protocol)
and setting WX_TX_FLAGS_SW_VLAN. This ensures the ATR feature selects
the correct hashing algorithm to maintain Tx/Rx queue symmetry.

Fixes: b501d261a5 ("net: txgbe: add FDIR ATR support")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/0879DA38A8E32701+20260724074657.10773-1-jiawenwu@trustnetic.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:43:52 +02:00
Christian Brauner
7b53e200d3
Merge patch series "vfs: call audit_inode_child() in lookup_open() on failure"
Jori Koolstra <jkoolstra@xs4all.nl> says:

While reworking lookup_open() to implement O_CREAT|O_DIRECTORY I came
across inconsistency in how audit_inode_child() is called in various
file create paths.

audit_inode_child() is called in may_create_dentry() so that failed
filesystem operations still register an audit entry. On success, the
entry is overwritten when, for instance, fsnotify_create() is called.
This is the calling convention in vfs_create() and vfs_mkdir().
In lookup_open(), however, when atomic_open() should have created a
file but didn't, no call to audit_inode_child() is made. The same is
true for the regular ->create() path.

On the suggestion of Christian, I am splitting this series from the
O_CREAT|O_DIRECTORY work, so that this can be discussed with the audit
people without delaying that work.

* patches from https://patch.msgid.link/20260710164233.827744-1-jkoolstra@xs4all.nl:
  fs/namei.c: update kerneldoc of atomic_open()
  vfs: call audit_inode_child() in lookup_open() on failure
  vfs: move create error && negative dentry case in lookup_open() up

Link: https://patch.msgid.link/20260710164233.827744-1-jkoolstra@xs4all.nl
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-30 12:16:56 +02:00
Jori Koolstra
ba0e870266
fs/namei.c: update kerneldoc of atomic_open()
The comments above atomic_open() contain several errors:

  - atomic_open() does not return 0 if successful
  - @path is not updated

Fix those and be more explicit about when FMODE_OPENED and FMODE_CREATED
are set. Change to a full kerneldoc.

Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260710164233.827744-4-jkoolstra@xs4all.nl
Reviewed-by: Paul Moore <paul@paul-moore.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-30 12:16:56 +02:00
Jori Koolstra
4886c80eef
vfs: call audit_inode_child() in lookup_open() on failure
audit_inode_child() is called in may_create_dentry() so that failed
filesystem operations still register an audit entry. On success, the
entry is overwritten when, for instance, fsnotify_create() is called.
This is the calling convention in vfs_create() and vfs_mkdir().
In lookup_open(), however, when atomic_open() should have created a
file but didn't, no call to audit_inode_child() is made. The same is
true for the regular ->create() path.

Fix the calling of audit_inode_child() in lookup_open() to match the
vfs_create() path. For the ->atomic_open() filesystems this logic has
been pushed into atomic_open(). This function is also reordered a bit
to make the case distinction of the possible returns from
->atomic_open() more explicit (i.e. finish_open() or finish_no_open()).

When retrying delegation breaking, audit_inode_child() could be called
more than once, but this is OK because those entries are reused.

Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260710164233.827744-3-jkoolstra@xs4all.nl
Acked-by: Paul Moore (audit) <paul@paul-moore.com>
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-30 12:16:56 +02:00
Jori Koolstra
4d315e54aa
vfs: move create error && negative dentry case in lookup_open() up
O_CREAT is stripped when create_error is set in lookup_open(), so when
lookup does not return an inode, the case

	if (!dentry->d_inode && (open_flag & O_CREAT))

is always skipped. We can get rid of this cognitive step by handling the
error case first.

Reviewed-by: NeilBrown <neil@brown.name>
Signed-off-by: Jori Koolstra <jkoolstra@xs4all.nl>
Link: https://patch.msgid.link/20260710164233.827744-2-jkoolstra@xs4all.nl
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
2026-07-30 12:16:55 +02:00
Paolo Abeni
12b4b11c11 Merge branch 'netpoll-finish-untangling-netconsole-from-netpoll'
Breno Leitao says:

====================
netpoll: finish untangling netconsole from netpoll

This is the final series moving the netconsole-specific functions out of
netpoll and into netconsole.

There is nothing else left except struct netpoll ->name and ->dev_mac
fields, which are netconsole-specific fields, but they are still in
netpoll structure (no other netpoll user uses these two fields).

netpoll is now left simpler and with a clearer role: an API that takes
an skb and transmits it. The device setup and the local/remote address
handling that only netconsole needs no longer sit in the generic netpoll
code, but in netconsole (which was the only user).

struct netpoll gets leaner too. The netconsole-only fields are gone, so
the other netpoll users (bonding, team, bridge, vlan, macvlan, dsa) no
longer carry fields they never touch. (except ->name and ->dev_mac)

Signed-off-by: Breno Leitao <leitao@debian.org>
====================

Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-0-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:44 +02:00
Breno Leitao
dc50a5c9cd netconsole: move netpoll_wait_carrier() as netcons_wait_carrier()
netpoll_wait_carrier() waits for the egress device carrier during
netconsole setup. Its only caller, netcons_netpoll_setup(), already
lives in netconsole. Move the function into drivers/net/netconsole.c,
drop EXPORT_SYMBOL_GPL() and remove the prototype from <linux/netpoll.h>.

Rename it to netcons_wait_carrier() for the netcons_ prefix. It now reads
the timeout through netpoll_get_carrier_timeout(), since carrier_timeout
stays in netpoll to keep the netpoll.carrier_timeout parameter.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-9-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
a111639647 netconsole: move local_ip/remote_ip/ipv6 to netconsole_target
With netpoll_setup() and the packet-building path now living in
netconsole, local_ip, remote_ip and ipv6 in struct netpoll are read
and written only by netconsole. No other netpoll user touches them.

Move the three fields into netconsole_target and switch the packet
builders and setup helpers to take the target instead of the netpoll
handle. struct netpoll is left holding only the device-binding state
that the shared netpoll transport needs.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-8-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
cf6de67ba4 netconsole: move egress_dev() as netcons_egress_dev()
move egress_dev() from netpoll to netconsole, and append netcons_
prefix.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-7-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
80fcfc3538 netconsole: move netpoll_take_ipv6() as netcons_take_ipv6()
Move netpoll_take_ipv6() to netconsole, and add netcons_ prefix.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-6-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
3aa9ff037b netconsole: move netpoll_take_ipv4() as netcons_take_ipv4()
Move netpoll_take_ipv4() to netconsole, which is the only user. Rename
it to netcons_take_ipv4() for the netcons_ prefix. The body is
unchanged.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-5-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
6a55e81d41 netconsole: move netpoll_local_ip_unset() as netcons_local_ip_unset()
Move netpoll_local_ip_unset() from netpoll to netconsole and rename it
to netcons_local_ip_unset();

The body is otherwise unchanged, only the comment's setup-function
reference is updated.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-4-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
672ecd3bb1 netconsole: take over netpoll_setup() from netpoll
netpoll_setup() is only used by netconsole. All the other users use
__netpoll_setup().

Move netpoll_setup() to netconsole, and rename it to
netcons_netpoll_setup().

Pure code motion: the body is unchanged.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-3-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
bb996303ef netpoll: export the netpoll_setup() helpers for netconsole
Temporarily export leaf functions that will be moved to netconsole.

The upcoming patch will move the setup function to netconsole, and
continue to call these leaf functions here in netpoll, then other
patches will move these exports functions to netconsole (and make them
statics).

In summary, these exports are temporary in order to make the patchset
digestible.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-2-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Breno Leitao
d93608b0a2 netpoll: export carrier_timeout via netpoll_get_carrier_timeout()
netpoll_wait_carrier() is only used in netconsole, and it will move to
netconsole.

The carrier_timeout module parameter has to stay in netpoll so the
existing netpoll.carrier_timeout kernel parameter keeps working for
current users, and we don't break user compatibility.

Add a netpoll_get_carrier_timeout() accessor and export it so netconsole
can read the value once the carrier wait lives there. Drop the now
redundant timeout argument from netpoll_wait_carrier() (its only caller
passed carrier_timeout) and read the parameter directly while the helper
still lives here.

Signed-off-by: Breno Leitao <leitao@debian.org>
Reviewed-by: Gustavo Luiz Duarte <gustavold@gmail.com>
Link: https://patch.msgid.link/20260724-netconsole_move_more_final-v1-1-a5f7691db81c@debian.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 12:14:39 +02:00
Yichong Chen
17463fe751 fanotify: stop permission watchdog when timeout is zero
The fanotify permission watchdog can be disabled by writing zero to
fs/fanotify/watchdog_timeout.  fanotify_perm_watchdog_group_add() already
checks for a zero timeout before scheduling the watchdog.

However, once the watchdog work has been scheduled, perm_group_watchdog()
unconditionally schedules itself again with the current timeout.  If the
sysctl is changed to zero while the work is active, secs_to_jiffies(0)
causes the work to be rescheduled immediately, resulting in a kworker
busy loop.

Read the timeout once in perm_group_watchdog_schedule() and do not
schedule the work when it is zero.  This lets a running watchdog stop
after the next execution when the sysctl is set to zero.

Fixes: b8cf8fda52 ("fanotify: add watchdog for permission events")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Link: https://patch.msgid.link/20260730070648.549458-1-chenyichong@uniontech.com
Signed-off-by: Jan Kara <jack@suse.cz>
2026-07-30 11:54:53 +02:00
Osama Abdelkader
2b8f13d3c7 drm/panthor: skip zero-sized firmware sections
panthor_fw_load_section_entry() skips BO creation when the firmware section
VA range is empty. If such a section is added to the firmware section list,
section->mem is left as NULL.

Later reload and unplug paths iterate over all firmware sections and
dereference section->mem, which can lead to a NULL pointer dereference.

Zero-sized firmware sections are valid, so accept them as no-op entries but
skip adding them to the section list.

Fixes: 2718d91816 ("drm/panthor: Add the FW logical block")
Cc: stable@vger.kernel.org
Signed-off-by: Osama Abdelkader <osama.abdelkader@gmail.com>
Reviewed-by: Liviu Dudau <liviu.dudau@arm.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20260724172621.63046-1-osama.abdelkader@gmail.com
Signed-off-by: Steven Price <steven.price@arm.com>
2026-07-30 10:49:57 +01:00
Chen Cheng
a47431dfb3 md/raid5: protect lockless recovery_offset accesses during reshape
During reshape:
- reshape_request() advances rdev->recovery_offset for non-In_sync
  devices locklessly.
- analyse_stripe() reads rdev->recovery_offset locklessly to decide:
    a. use a replacement device to read ?
    b. a device can already be treated as in-sync for the current
       stripe ?

one possible scenario is:

CPU1                            CPU2
reshape_request()
-> mddev->curr_resync_completed = sector_nr
-> if (!mddev->reshape_backwards)
-> rdev->recovery_offset = sector_nr
                                analyse_stripe(sh)
                                -> rdev = conf->disks[i].replacement
                                -> if (rdev->recovery_offset >=
                                      sh->sector + stripe_sectors)
                                   set_bit(R5_ReadRepl)
                                -> or
                                -> if (sh->sector + stripe_sectors <=
                                      rdev->recovery_offset)
                                   set_bit(R5_Insync)

And it could be:

- reading from a replacement before it is recovered far enough; or
- treating a not-yet-recovered device as in-sync for the current stripe.

Fixes: db0505d320 ("md: be cautious about using ->curr_resync_completed for ->recovery_offset")

The race report:
==================================================================
BUG: KCSAN: data-race in ops_run_io / reshape_request

write to 0xffff8bdee168b270 of 8 bytes by task 1704 on cpu 10:
 reshape_request+0x1292/0x17b0
 raid5_sync_request+0x815/0xa00
 md_do_sync.cold+0xf8d/0x1516
 [......]

read to 0xffff8bdee168b270 of 8 bytes by task 1696 on cpu 9:
 ops_run_io+0xc25/0x1960
 handle_stripe+0x2273/0x4570
 handle_active_stripes.isra.0+0x6e0/0xa50
 raid5d+0x7d5/0xb90
 [......]

value changed: 0x0000000000091a00 -> 0x0000000000091b00
==================================================================

Signed-off-by: Chen Cheng <chencheng@fnnas.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Link: https://patch.msgid.link/20260627102519.136940-1-chencheng@fnnas.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
2026-07-30 17:46:21 +08:00
Chen Cheng
788e413946 md/raid5: fix reshape deadlock while failed devices more than max degraded
reshape stripe lifetime:
- start reshape ==> reshape_request():
	* get destination stripe,
	  - if need to copy source data chunks, set STRIPE_EXPANDING;
	  - or, if new regions past the old end of the array, zero-filled,
	    no need source data, set STRIPE_EXPANDING | STRIPE_READY
	* get source stripe,
	  - set STRIPE_EXPAND_SOURCE

- handle expand stripe ==> handle_stripe():
	reshape use reconstruct-write to construct stripe,
	four stages:
	1. prepare source data chunks for old geometry stripe
		- fill source stripe data by read or compute
	2. move data from old geometry source stripe to new geometry
	   destination stripe
		- source stripe clear STRIPE_EXPAND_SOURCE
		- drain data from source to destination stripe
		- mark stripe chunk as R5_Expanded|R5_UPTODATE when the
		  drain from source chunk to destination chunk is completed
		- all stripe chunks drain are completed, then mark
		  STRIPE_EXPAND_READY
	3. calculate p/q chunks for destination stripe
		- if destination stripe doesn't depends on source dstripe,
		  then we can clear STRIPE_EXPANDING
	4. write-out to disks and release
		- set R5_Wantwrite|R5_Locked, writeout to disk
		- if write-out succeeded, clear STRIPE_EXPAND_READY, and
		  decrement reshape_stripe, call md_done_sync() to report
		  reshape progress.

1. cleanup the following kinds of **destination stripe**
	when failed device more than max degraded:
  - new regions past the old end of the array, zero-filled in place,
    requires no source data.
	(STRIPE_EXPANDING | STRIPE_EXPAND_READY)
  - prepare source data chunks already done, and writeout failed
	(STRIPE_EXPAND_READY)

2. destination stripes that need source data
	(STRIPE_EXPANDING, no STRIPE_HANDLE)
  - these kind of stripes sit idle in the stripe cache and are never seen
    by handle_stripe(). So clean up indirectly when their source stripe
    (type 3) is processed.

3. source stripes (STRIPE_EXPAND_SOURCE)
  - hit handle_stripe() after their member disks are marked Faulty.
  - clear STRIPE_EXPAND_SOURCE, finds and cleanup all dependent destination
    stripes that were waiting for data.
  - walks the source's data disks, compute the corresponding destination
    sector, looks up the destination stripe, and do cleanup(clear flags,
    dec counters, call md_done_sync())

Reproducer:
  - Create a 4-disk RAID5 with mdadm on top of 5 disposable test disks
    wrapped by dm targets.
  - Add the 5th device as a spare and start a 4 -> 5 reshape.
  - Wait until /sys/block/mdX/md/sync_action reports "reshape".
  - Inject failures on two members so reshape exceeds max_degraded.
  - After a few seconds, write "frozen" to /sys/block/mdX/md/sync_action.
    Before this fix, the write blocks indefinitely.

Read-error variant:
  - Use dm-dust on /dev/sd[b-f].
  - Preload bad blocks on two source members, e.g. dust0 and dust1:
      dmsetup message dust0 0 addbadblock <range>
      dmsetup message dust1 0 addbadblock <range>
  - Start reshape:
      mdadm -C /dev/mdX -e 1.2 -l 5 -n 4 -c 64 \
            --assume-clean /dev/mapper/dust{0..3}
      mdadm --manage /dev/mdX --add /dev/mapper/dust4
      mdadm --grow /dev/mdX -n 5 --backup-file=/tmp/grow.backup &
  - Once reshape starts, enable the injected read failures:
      dmsetup message dust0 0 enable
      dmsetup message dust1 0 enable
  - Then:
      echo frozen > /sys/block/mdX/md/sync_action
    hangs forever before the fix.

Write-error variant:
  - Use dm-flakey on /dev/sd[b-f].
  - Start the same 4 -> 5 reshape on flakey0..flakey4.
  - Once reshape starts, switch two members, e.g. flakey3 and flakey4,
    to error_writes.
  - Then:
      echo frozen > /sys/block/mdX/md/sync_action
    hangs forever before the fix.

md_do_sync() exits its main loop on MD_RECOVERY_INTR but then blocks
forever at:

  wait_event(mddev->recovery_wait,
		!atomic_read(&mddev->recovery_active));

After the fix recovery_active drains to zero, md_do_sync() prints

    md/raid:md0: Cannot continue operation (2/5 failed).
    md: md0: reshape interrupted.

Signed-off-by: Chen Cheng <chencheng@fnnas.com>
Reviewed-by: Yu Kuai <yukuai@fygo.io>
Link: https://patch.msgid.link/20260624075824.2601110-1-chencheng@fnnas.com
Signed-off-by: Yu Kuai <yukuai@fygo.io>
2026-07-30 17:37:00 +08:00
Paolo Abeni
dcdd4035c9 Merge branch 'airoha-add-the-capability-to-configure-gdm3-gdm4-as-wan-lan-on-demand'
Lorenzo Bianconi says:

====================
airoha: add the capability to configure GDM3/GDM4 as WAN/LAN on demand

Add the capability to configure GDM3/GDM4 as WAN/LAN on demand when QoS
offload is created or destroyed.
Make dev->qdma an RCU pointer so the TX path can safely dereference it
without holding RTNL.
Introduce airoha_qdma_start() and airoha_qdma_stop() helpers.
====================

Link: https://patch.msgid.link/20260725-airoha-ethtool-priv_flags-v12-0-5136a30b2157@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:36:48 +02:00
Lorenzo Bianconi
78a35725e5 net: airoha: defer GDM3/GDM4 WAN mode and GDM2 loopback to QoS offload
GDM3 and GDM4 ports require GDM2 loopback to be enabled for hardware
QoS offload to function. Without it, HTB and ETS offload on these ports
do not work.
Previously, GDM3/GDM4 ports were automatically configured as WAN with
GDM2 loopback enabled during ndo_init().
Add the capability to configure GDM3/GDM4 as WAN/LAN on demand when QoS
offload is created or destroyed.
Hook airoha_enable_qos_for_gdm34() into TC_HTB_CREATE so that requesting
HTB offload on a GDM3/GDM4 LAN port switches it to WAN mode and enables
GDM2 loopback.
Introduce the AIROHA_DEV_F_TX_QOS flag to track whether a device has an
active TX HTB qdisc; set it in airoha_tc_setup_qdisc_htb() on successful
TC_HTB_CREATE and clear it on TC_HTB_DESTROY. The device keeps its WAN
role after qdisc teardown so that its configuration is preserved until
another device explicitly needs the WAN role for QoS offload.
If another GDM3/GDM4 device already holds the WAN role without an active
TX qdisc, demote it to LAN before promoting the requesting device. Skip
the demotion when the requesting device is itself already the WAN device.
Since airoha_dev_set_qdma() can now be called on a running device to
migrate between QDMA blocks, make dev->qdma an RCU pointer so the TX path
can safely dereference it without holding RTNL.
When migrating between QDMA blocks, stop TX queues, swap the pointer via
rcu_assign_pointer(), then synchronize_rcu() to ensure no in-flight
ndo_start_xmit holds the old pointer.
Serialize netdev_tx_completed_queue() calls via per-TX-queue spinlocks
txq_lock[] so that both the old and new QDMA NAPI instances can complete
packets concurrently on the same netdev TX queues without racing on
dql_completed().
Hold flow_offload_mutex in airoha_enable_qos_for_gdm34() and
airoha_disable_qos_for_gdm34() around the dev->flags update,
airoha_dev_set_qdma() and GDM2 loopback configuration, serializing
against concurrent airoha_ppe_hw_init() in the TC_SETUP_CLSFLOWER
offload path.
Introduce airoha_qdma_deref() helper that wraps rcu_dereference_protected()
with a lockdep condition accepting either rtnl_lock or flow_offload_mutex,
and use it across all control-path dereferences of the RCU-protected
dev->qdma pointer.
Add airoha_disable_gdm2_loopback() to disable GDM2 hw loopback.

Tested-by: Madhur Agarwal <madhur.agrawal@airoha.com>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260725-airoha-ethtool-priv_flags-v12-3-5136a30b2157@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:36:46 +02:00
Lorenzo Bianconi
8b9a508819 net: airoha: fix ETS QoS stats counter underflow and cross-channel corruption
airoha_qdma_get_tx_ets_stats() has two bugs:
- The hardware counters read via airoha_qdma_rr() are 32-bit values
  but are stored in u64 locals and subtracted from u64 baselines. When
  a 32-bit hardware counter wraps around, the subtraction produces a
  large underflow value passed to _bstats_update().
- The baseline counters (cpu_tx_packets, fwd_tx_packets) are stored as
  single per-device fields, but airoha_qdma_get_tx_ets_stats() is
  called with different channel values (0-3). Each call reads a
  different channel's hardware counter but overwrites the same
  baseline, corrupting the delta computation for other channels.

Fix both by:
- Narrowing the counter locals and baselines to u32 so that 32-bit
  unsigned subtraction handles wrap-around naturally.
- Grouping the baselines into a per-channel qos_stats array so each
  channel tracks its own previous counter value independently.
- Splitting the delta addition into two statements so the first u32
  delta is widened to u64 on assignment and the second is added in
  u64 arithmetic, preventing overflow when both deltas are large.

Fixes: 20bf7d07c9 ("net: airoha: Add sched ETS offload support")
Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260725-airoha-ethtool-priv_flags-v12-2-5136a30b2157@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:36:46 +02:00
Lorenzo Bianconi
0040ff44cd net: airoha: rename airoha_priv_flags to airoha_dev_flags
Rename the airoha_priv_flags enum to airoha_dev_flags and the
AIROHA_PRIV_F_WAN flag to AIROHA_DEV_F_WAN. The "priv_flags" naming
dates back to an earlier design that used ethtool private flags; since
this series switched to tc qdisc offload for LAN/WAN configuration,
align the naming to reflect that these are per-device flags rather than
ethtool private flags.

While at it, switch to test_bit()/set_bit()/clear_bit() APIs and
convert the flags field from u32 to unsigned long to make flags
manipulation atomic.

Reviewed-by: Simon Horman <horms@kernel.org>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/20260725-airoha-ethtool-priv_flags-v12-1-5136a30b2157@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:36:46 +02:00
Bob Song
3b36ac9373 ALSA: hda/realtek: add missing NULL check for codec->bus->pci
In alc269_probe(), codec->bus->pci is dereferenced without a NULL check
for the ALC236 vendor ID case. Add the missing check, consistent with
the existing pattern used elsewhere in the same function.

Signed-off-by: Bob Song <songxiebing@kylinos.cn>
Link: https://patch.msgid.link/20260730015302.253008-2-songxiebing@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-30 11:34:52 +02:00
Bob Song
5b106b40ed ALSA: hda/realtek: add missing error checks for COEF index reads in alc269
alc_read_coef_idx() and alc_read_coefex_idx() can return -1 on error
via snd_hda_codec_read(). Several codec initialization and shutdown
functions save these return values and later write them back to
hardware registers without checking for errors, potentially corrupting
COEF register state on a read failure.

Add error checks in:
- alc282_init() and alc282_shutup(): check coef78 before write-back
- alc285_hp_init(): check coef38/coef0d/coef36 before update, check
  val before write-back, and break polling loop on error
- alc294_hp_init(): break polling loop on read error

Signed-off-by: Bob Song <songxiebing@kylinos.cn>
Link: https://patch.msgid.link/20260730015302.253008-1-songxiebing@kylinos.cn
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-30 11:32:56 +02:00
Marco Giunta
494978ae82 ALSA: hda/realtek: enable AW88399 on Lenovo Legion Pro
Enable audio output through the AW88399 woofer amplifiers on Lenovo
Legion laptops by adding the necessary Realtek ALC287 fixups and
AW88399 per-model quirks.

Realtek fixups (alc269.c):

* ALC287_FIXUP_AW88399_I2C_2: registers the AW88399 as a two-instance
  I2C companion codec using comp_generic_fixup, matching ACPI HID
  "AWDZ8399".

* ALC287_FIXUP_LENOVO_LEGION_AW88399: forces DAC 0x02 for the bass
  speaker pin 0x17, as the default DAC 0x06 lacks volume controls.
  Also applies internal microphone boost calibration via
  alc269_fixup_limit_int_mic_boost and disables unused pin 0x1d
  to match the Windows driver's pin configuration.
  Chained to ALC287_FIXUP_AW88399_I2C_2.

Per-model quirks (aw88399_hda.c):

* Channel swap: the I2C wiring on these Legion models is reversed
  (0x34 is physically the right speaker, 0x35 is the left). The
  quirk swaps the channel assignment to correct L/R audio.

* BSTS status bypass: the AW88399's boost-finished status bit (BSTS,
  SYSST register bit 9) does not reliably assert on this hardware.
  Register dumps during normal playback show both amplifiers
  reporting BSTS=0 on both channels despite clean audio output.
  The quirk sets the bsts_unreliable flag, introduced in
  commit b4530a3e48 ("ASoC: aw88399: add per-instance BSTS status bypass flag"),
  so the startup status check skips the BSTS requirement
  on these devices.

The R9000P ADR10 entries use HDA_CODEC_QUIRK and are placed before
the existing SND_PCI_QUIRK for 17aa:38bb (Yoga S780-14.5 Air) to
ensure the codec SSID match takes priority over the shared PCI SSID,
following the pattern established by e.g.
commit 0f3a822ae2 ("ALSA: hda/realtek: Fix quirk matching for Legion Pro 7"),
commit dd074f04e0 ("ALSA: hda/realtek: Fix Legion 7 16ITHG6 speaker amp binding").
All other entries also use HDA_CODEC_QUIRK for consistency.

Supported models (Lenovo vendor ID 0x17aa):

* 0x3906: Legion Pro 7i 16IAX10H / Y9000P IAX10 (Intel)
* 0x3907: Legion Pro 7i 16IAX10H / Y9000P IAX10 (Intel)
* 0x3927: Legion R9000P ADR10 (AMD)
* 0x3928: Legion R9000P ADR10 (AMD)
* 0x3938: Legion Pro 7 16AFR10H (AMD)
* 0x3939: Legion Pro 7 16AFR10H (AMD)

Tested-by: Nadim Kobeissi <nadim@symbolic.software>
Tested-by: Xia Yun'an <imitoy@imitoy.top>
Tested-by: Munzir Taha <munzirtaha@gmail.com>
Co-developed-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/DS7PR19MB7724ACD7C8D1BE71451E1AEEFCCA2@DS7PR19MB7724.namprd19.prod.outlook.com
2026-07-30 11:29:21 +02:00
Marco Giunta
de7027c914 ALSA: hda/scodec: add AW88399 HDA side codec driver
Add an HDA side codec driver for the AWINIC AW88399 smart amplifier,
enabling its use as a companion amplifier on HDA systems where the
chip is connected via I2C to the host and driven alongside a primary
HDA codec (such as Realtek ALC287).

The driver is structured after the existing side codec drivers:

* aw88399_hda_i2c.c: I2C bus driver matching ACPI HID "AWDZ8399" and
  serial-multi-instantiate device name "aw88399-hda".
  Creates the regmap and passes it to the shared probe function,
  following the CS35L41/CS35L56/TAS2781 pattern.

* aw88399_hda.c: Core driver implementing HDA component binding,
  playback hooks (using the shared library's start/stop functions),
  ACPI subsystem ID retrieval, and runtime/system power management.
  Includes per-model quirk infrastructure using ACPI subsystem ID
  matching; the quirk table is empty in this patch and populated in
  the next patch along with the corresponding Realtek fixups that
  activate the driver.

The driver includes <sound/aw88399.h> for shared definitions and
depends on SND_SOC_AW88399_LIB for chip initialization, firmware
loading, and playback control, avoiding any dependency on the full
ASoC codec module.

Tested-by: Nadim Kobeissi <nadim@symbolic.software>
Tested-by: Xia Yun'an <imitoy@imitoy.top>
Tested-by: Munzir Taha <munzirtaha@gmail.com>
Co-developed-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/DS7PR19MB77247D67E739956AA4611ACEFCCA2@DS7PR19MB7724.namprd19.prod.outlook.com
2026-07-30 11:29:21 +02:00
Marco Giunta
6f5f85d10e ACPI/platform: add AWDZ8399 to serial-multi-instantiate
Register the AWINIC AW88399 ACPI hardware ID "AWDZ8399" with the
serial-multi-instantiate driver and add it to the ACPI scan ignore
list so that the two I2C amplifier instances on Lenovo Legion laptops
are enumerated as separate I2C client devices rather than a single
ACPI platform device.

The SMI node creates two instances named "aw88399-hda" with
IRQ_RESOURCE_AUTO, matching the pattern used by CS35L41.

Tested-by: Nadim Kobeissi <nadim@symbolic.software>
Tested-by: Xia Yun'an <imitoy@imitoy.top>
Tested-by: Munzir Taha <munzirtaha@gmail.com>
Acked-by: Rafael J. Wysocki (Intel) <rafael@kernel.org>
Acked-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Co-developed-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Yakov Till <yakov.till@gmail.com>
Signed-off-by: Marco Giunta <marco_giunta@outlook.it>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/DS7PR19MB7724431AE60B3D2280E73492FCCA2@DS7PR19MB7724.namprd19.prod.outlook.com
2026-07-30 11:29:21 +02:00
Qingfang Deng
26ba17d845 ovpn: fix incorrect use of rcu_access_pointer()
rcu_access_pointer() should only be used to test the value of a pointer,
not to dereference it. As it's in a spin_lock_bh() critical section, use
rcu_dereference_bh() instead, avoiding an extra rcu_read_lock().

Fixes: f6226ae7a0 ("ovpn: introduce the ovpn_socket object")
Signed-off-by: Qingfang Deng <qingfang.deng@linux.dev>
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
4680c0ebd9 ovpn: ensure TCP vars are initialized first
Netlink calls may access TCP global vars (i.e. when attaching
a TCP socket), therefore we need to make sure the
latters are initialized beforehand.

For this reason move the global TCP initialization at the top
of the module init function.

Fixes: 11851cbd60 ("ovpn: implement TCP transport")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
0301aa3249 ovpn: disable IPv4 redirects on MP interfaces
ovpn_mp_alloc() tried to disable SEND_REDIRECTS on a multipeer
interface, but it runs from ovpn_net_init() (->ndo_init), which
register_netdevice() invokes before the NETDEV_REGISTER notifier
chain. The IPv4 in_device is only created when that notifier reaches
inetdev_event() -> inetdev_init(), so __in_dev_get_rtnl() always
returned NULL at ndo_init time and the whole redirect-disabling block
(both the per-device and the per-netns IPV4_DEVCONF_ALL write) was
dead. MP interfaces therefore kept emitting ICMP redirects.

Disabling redirects only once is not enough either: the IPv4
in_device is destroyed and recreated when the interface is moved to a
different network namespace (NETDEV_UNREGISTER/NETDEV_REGISTER), and
the newly created in_device inherits the destination namespace
defaults, silently re-enabling SEND_REDIRECTS.

Disable redirects from ovpn_net_open() (->ndo_open) instead: it runs
every time the interface is brought up, including after the in_device
has been recreated, so the setting is always re-applied. This mirrors
what wireguard does in wg_open(). RTNL is held on the ndo_open() path,
so __in_dev_get_rtnl() is safe.

Fixes: 05003b408c ("ovpn: implement multi-peer support")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
b47a52dcd5 ovpn: hash floated peer by transport identity only
The by_transp_addr table is keyed on the peer's remote transport
address, but the float rehash hashed bind->remote directly, while the
two other sites that touch the table build a clean key first:
ovpn_peer_add_mp() and the lookup in ovpn_peer_get_by_transp_addr()
both hash a sockaddr holding only family/address/port.

For a link-local IPv6 peer, bind->remote carries sin6_scope_id (set
from ipv6_iface_scope_id() when the endpoint is learned), and that
field is folded into the jhash() over sizeof(struct sockaddr_in6).
The lookup never sets sin6_scope_id, so after such a peer floats it is
rehashed into a scope_id-dependent bucket that lookups (scope_id 0)
never visit, making the peer unreachable through the by_transp_addr
fallback. ovpn_peer_transp_match() only compares address and port, so
the hash was keying on a field the match ignores.

sin6_scope_id must stay in bind->remote because the TX path uses it as
flowi6_oif, so it cannot just be cleared there. Instead build the hash
key from family/address/port only, exactly like ovpn_peer_add_mp() and
the lookup, so all three sites agree on the bucket.

Fixes: f0281c1d37 ("ovpn: add support for updating local or remote UDP endpoint")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
3f012bdbab ovpn: zero-initialize sockaddr before learning a floated endpoint
ovpn_peer_endpoints_update() builds the new remote endpoint in an
on-stack struct sockaddr_storage that is left uninitialized. For IPv4
only sin_family/sin_addr/sin_port are written, leaving the 8-byte
sin_zero padding as stack garbage (for IPv6, sin6_flowinfo is left
uninitialized likewise).

ovpn_peer_reset_sockaddr() -> ovpn_bind_from_sockaddr() then memcpy()s
sizeof(struct sockaddr_in)/sizeof(struct sockaddr_in6) bytes - padding
included - into bind->remote. That buffer is later hashed with jhash()
over the same length to place the peer in the by_transp_addr table, so
the garbage padding lands the floated peer in an essentially random
bucket. Lockless lookups in ovpn_peer_get_by_transp_addr() build their
key from a zero-initialized sockaddr_storage, compute a different bucket
and fail to find the peer.

This is also a plain use of uninitialized stack memory in jhash().

Build the floated endpoint with a designated initializer so the
padding (sin_zero for IPv4, sin6_flowinfo for IPv6) is zeroed as part
of the assignment. This keeps the padding out of the by_transp_addr
hash key without memset-ing the whole sockaddr_storage on every
received packet.

Fixes: f0281c1d37 ("ovpn: add support for updating local or remote UDP endpoint")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
59aed1eb60 ovpn: ensure socket is owned by ovpn before deref sk_user_data
Some subsystems, like BPF SOCKMAP, set sk_user_data without
actually setting the encap_type.

For this reason, we must make sure that the type is the
one ovpn expects before dereferencing sk_user_data.

Failing to do so may lead to out-of-bounds reads.

Fixes: f6226ae7a0 ("ovpn: introduce the ovpn_socket object")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
cc12f7240c ovpn: rehash peer in by_transp_addr table on CMD_PEER_SET
When userspace updates a peer's remote endpoint via OVPN_CMD_PEER_SET,
ovpn_nl_peer_modify() installs a new ovpn_bind through
ovpn_peer_reset_sockaddr(), but ovpn_nl_peer_set_doit() only calls
ovpn_peer_hash_vpn_ip() to refresh the VPN-IP hashtables. The peer is
left in the bucket of peers->by_transp_addr corresponding to its old
remote address.

As a consequence, datagrams arriving at the UDP RX path from the newly
configured remote hash to a different slot and the lockless lookup in
ovpn_peer_get_by_transp_addr() (called from ovpn_udp_encap_recv()) does
not find the peer, until either a float event or a peer re-add fixes
the bucket.

Introduce ovpn_peer_hash_transp_addr() (modeled after
ovpn_peer_hash_vpn_ip()) and invoke it from ovpn_nl_peer_set_doit()
whenever the request carried a new remote address. The helper bails
out in P2P mode and on peers without a bind (TCP), and relies on
hlist_nulls_del_init_rcu()'s pprev==NULL short-circuit to handle the
case of an entry not currently linked in the table.

Fixes: 1d36a36f6d ("ovpn: implement peer add/get/dump/delete via netlink")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Antonio Quartulli
33ec10567f ovpn: skip rehash for peers already removed from by_id
ovpn_nl_peer_set_doit() resolves the target peer via
ovpn_peer_get_by_id() before taking ovpn->lock. In the window between
the lookup (which only takes a refcount) and the subsequent
spin_lock_bh(&ovpn->lock), a concurrent OVPN_CMD_PEER_DEL, keepalive
expiry, or socket teardown can take ovpn->lock first, run
ovpn_peer_remove() to unhash the peer from all four tables (by_id,
by_vpn_addr4/6, by_transp_addr) and release the lock. set_doit then
acquires ovpn->lock and calls ovpn_peer_hash_vpn_ip(), which
re-inserts the now-removed peer back into the rehashing tables.

The same race affects the float path: ovpn_peer_endpoints_update()
holds only a refcount and acquires ovpn->lock very late (after async
AEAD decrypt and a netlink notification), then rehashes the peer
in the by_transp_addr table.

The resurrected peer becomes reachable again from the RX lookup
(ovpn_peer_get_by_transp_addr) and the TX VPN-IP lookup, even though
userspace believes it is gone. Once the data-path refcount drops the
peer is freed via call_rcu while the hash entries embedded in it
remain linked, opening a UAF window.

Bail out of the rehash when hash_entry_id is unhashed, mirroring
the sentinel already used by ovpn_peer_remove() to detect the
already-removed state. The check is safe under ovpn->lock, which
serializes every mutation of hash_entry_id, and is a no-op for the
add path because ovpn_peer_add_mp() inserts hash_entry_id before
calling ovpn_peer_hash_vpn_ip().

Fixes: 1d36a36f6d ("ovpn: implement peer add/get/dump/delete via netlink")
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Marco Baffo
935dc3bb20 ovpn: limit keepalive values to one day
Large keepalive values can overflow the delayed-work delay on 32-bit
systems, causing the keepalive worker to be repeatedly scheduled.

A correct configuration should not require such large keepalive values,
and an upper limit of one day is already generous and unnecessary in
practice. Limit both the keepalive interval and timeout to 86400 seconds.

Signed-off-by: Marco Baffo <marco@mandelbit.com>
Signed-off-by: Antonio Quartulli <antonio@openvpn.net>
2026-07-30 11:28:30 +02:00
Arnd Bergmann
253b1036b9 MediaTek ARM64 DeviceTree updates
This adds a couple of fixes and improvements for multiple
 MediaTek SoCs.
 
 In particular:
 - Indentation/whitespace fixes for some devicetrees
 - Documentation improvements for MediaTek Mute-X
 - dtbs-check warnings fixes
   - MT8390 Tungsten boards: removal of unnecessary cells
   - MT6795 SoC: removal of deprecated property in UART DMA
 - MT6359 PMIC's RTC now uses the correct compatible string
 - MT8183/86/88/92/95 SoCs gain support for the UART DMA IPs
 - MT8186 gets a new CCI OPP table to resolve lockups
 - MT8188/83 Chromebooks now got the correct SPI NOR supply
 - MT8192 Asurada drops support for the (unused) MMC1 port
 - MediaTek Genio 510/700/1200 EVKs and Radxa NIO-12L now get
   their PMIC power input tree completed with assignment of
   the correct supplies
 -----BEGIN PGP SIGNATURE-----
 
 iLoEABYKAGIWIQQn3Xxr56ypAcSHzXSaNgTPrZeEeAUCamsKqBsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDIoHGFuZ2Vsb2dpb2FjY2hpbm8uZGVscmVnbm9AY29s
 bGFib3JhLmNvbQAKCRCaNgTPrZeEeMdDAP49I6x+l77XLzg/PRjbNu7Af5TB30dZ
 8U9Lg/JVkt3ErgEAuTKsOhlN43fk0iBcvmK/A6nLMWW0lb7RnbhAXyRXXwI=
 =3hmo
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmprGWkACgkQmmx57+YA
 GNnmLBAAq7OGHXTWuWaRNdsUq/LeA+CifO3Hah0giYBQDEJ940XRgosfBIw5/nEA
 rPym1hIYQ5G9eJNQHzBGLlVk83dEcCB6RpqXJUwG176sPuaSDULnkL0c8nNDtMIY
 Rgpm/WhizEBlZlqawbNLGHlY6Nii0xNZJuHqq8SiP6vwyYR9bBfrfXEAzvA/ymS0
 rnVUtPh2NA4OZ2/7RW+STr6X9XrtRL5a3DEtJSsVJevfxDn3/XAicdgRRqd3vqGj
 +1VaNffXhFRQRHMbFgVn49e8xhcq8S9tBTgp82mRB2UK4e5yrlJLbI/vJJQvj3+S
 AZjoitLf3rdmYMn8pPQ0ohuMSszoh8VkLEscDav42zQ+0LIb++usz5vEoUA9qXLy
 wQZx2fmiwuH50J7jOLdUQ9rF/0lmrb0VF7LtwnlvzBuTarZBDR7evb4+eTUb5M4E
 Fs7oeaxLI4bV73X8OBCzFv8mxX5hlMKXgftaRDwlhq7uBoyobkj8AdTuMMK01wkn
 gXBCMACwoNk13zAJVW86qG6Sr3mzNTxqnuL4lKLCHnt8QuuMmpDRFe1A/HNR3IxA
 Ouv18uzqfAzwq+murnpXUFPEQqj58J47HKRzZGL0JrEnfFnQS6Ch4jph/U4Jrt6i
 4n//bYqn4XTeMkqm+aeQddWNQulMqN9c9xHEJ7yq5UUbKNYB9OQ=
 =iRpe
 -----END PGP SIGNATURE-----

Merge tag 'mtk-dts64-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux into soc/dt

MediaTek ARM64 DeviceTree updates

This adds a couple of fixes and improvements for multiple
MediaTek SoCs.

In particular:
- Indentation/whitespace fixes for some devicetrees
- Documentation improvements for MediaTek Mute-X
- dtbs-check warnings fixes
  - MT8390 Tungsten boards: removal of unnecessary cells
  - MT6795 SoC: removal of deprecated property in UART DMA
- MT6359 PMIC's RTC now uses the correct compatible string
- MT8183/86/88/92/95 SoCs gain support for the UART DMA IPs
- MT8186 gets a new CCI OPP table to resolve lockups
- MT8188/83 Chromebooks now got the correct SPI NOR supply
- MT8192 Asurada drops support for the (unused) MMC1 port
- MediaTek Genio 510/700/1200 EVKs and Radxa NIO-12L now get
  their PMIC power input tree completed with assignment of
  the correct supplies

* tag 'mtk-dts64-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux:
  arm64: dts: mediatek: mt6359: use proper compatible for rtc
  arm64: dts: mediatek: mt8395-radxa-nio-12l: Add MT6365 PMIC supplies
  arm64: dts: mediatek: mt8395-genio-common: Add MT6365 PMIC supplies
  arm64: dts: mediatek: mt8390-genio-common: Add MT6365 PMIC supplies
  arm64: dts: mediatek: mt8192-asurada: Disable mmc1 on Spherion
  dt-bindings: soc: mediatek: mutex: Improve title and description
  arm64: dts: mediatek: mt8195: Add and use UART AP_DMA controller
  arm64: dts: mediatek: mt8192: Add and use UART AP_DMA controller
  arm64: dts: mediatek: mt8188: Add and use UART AP_DMA controller
  arm64: dts: mediatek: mt8186: Add and use UART AP_DMA controller
  arm64: dts: mediatek: mt8183: Add and use UART AP_DMA controller
  arm64: dts: mediatek: mt6795: Remove deprecated UART DMA property
  arm64: dts: mediatek: tungsten-smarc: Remove unnecessary cells
  arm64: dts: mediatek: Correct indentation and whitespace
  arm64: dts: mediatek: mt8188-geralt: Add supply for SPI NOR flash
  arm64: dts: mediatek: mt8183-kukui: Add supply for SPI NOR flash
  arm64: dts: mediatek: mt8186: change CCI OPP scaling mapping

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-07-30 11:28:26 +02:00
Takashi Iwai
cbae176309 Merge branch 'for-linus' into for-next
Pull 7.2 devel branch for applying further patches cleanly.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-30 11:28:26 +02:00
Arnd Bergmann
fb1cb3242b MediaTek ARM32 DeviceTree updates
This fixes a minor indentation issue in the MT8127 devicetree
 and adds support for the Auxiliary ADC found in the MT6323 PMIC.
 -----BEGIN PGP SIGNATURE-----
 
 iLoEABYKAGIWIQQn3Xxr56ypAcSHzXSaNgTPrZeEeAUCamsCiBsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDIoHGFuZ2Vsb2dpb2FjY2hpbm8uZGVscmVnbm9AY29s
 bGFib3JhLmNvbQAKCRCaNgTPrZeEeBPiAP9lr1/GKI8x8ic4JtzZRYfTf9wOJUjL
 L+k64fFBWZHn8wD+MBGSwiCXpudcN4GkLS0HKN7UkDL5gcdlCgZ4DbeLAgA=
 =PxxN
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmprGPcACgkQmmx57+YA
 GNnbGhAAmoaFmscdDKzVodn4eQB+TIGpD2XxE6qrYbD9k7LE2Kp2tnrjjvfsTsr4
 JBeHQUnjZgAXVmpdWBqxan5GrgXThvKoWvsPtADR06SiIEk2wxCS4Pwh97629FQE
 w+zpABMuq/sgPhAiSvVZIsAlhPUzvx8ILuA69HE7wBiHHpDh3Zl9yZiskcikc3K9
 Egd2Q2tw+OkgYfW1ccIgQFwyum5ot/tcQoKGLPugvzDa6fHj8gXfiUOFSlqK7ak0
 oQCT8Ue+l2MiCVcURLKMEukuxe7sq+PdHtW+V6q0LpVfUskYJ3rWs+qT7e0lWH2n
 9zlL0xh8zBTOgVC22uJJvpRcCHrp0tbusXZzbGKQOFVBZSJOhlMkW3uUqk0sAg8B
 RldqDsTFH2WfoZjsI4SWV1hRoM1gqvHUu1gDroJYglwcFMjsLJMlMdNmHI7MupsO
 DCvG2gAx+Kj5Gz4Gf+LDFx5khS3ucIsjPl+VR+1foGxLcoWYvI0KgV5lqMWecaKr
 7NowJYN1SHfqNozyMUkNb/qGJrX+1jBjUHuPp758GC2FnMXh0hB8/XJuFc5n09E7
 U/T9DvEdltgx+7dDYrL5BP/ZkxeGY6F/kd47zCd5LVeQovJAiE5wD+lbGN09oYsf
 54tTfbIwiO7NH/+uiR2HIa3EMbSV0xIalFe9VS9iXuK5nUE43xc=
 =rAn0
 -----END PGP SIGNATURE-----

Merge tag 'mtk-dts32-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux into soc/dt

MediaTek ARM32 DeviceTree updates

This fixes a minor indentation issue in the MT8127 devicetree
and adds support for the Auxiliary ADC found in the MT6323 PMIC.

* tag 'mtk-dts32-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux:
  ARM: dts: mediatek: mt6323: add AUXADC support
  ARM: dts: mediatek: mt8127: Correct indentation

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-07-30 11:27:06 +02:00
Arnd Bergmann
ed9bfc3a91 ARM: dts: imx device tree updates for v7.3
Cleanup CHECK_DTBS warnings:
 - Remove undocumented properties (nand-ecc-*, clock-names, default-state)
 - Rename display@0 to display0 (ls1021a-iot)
 - Add led suffix to node names (ls1021a-moxa-uc-8410a)
 - Replace spansion,s25fl164k with jedec,spi-nor (ls1021a-moxa-uc-8410a)
 - Use ethernet-phy-ieee802.3-c22 compatible string (ls1021a-moxa-uc-8410a)
 - Rename eim-cs1 node to eim-cs1-bus (imx53-ard)
 - Add power-supply for LCD panel (ls1021a-twr)
 - Add fsl,ls1021aqds-fpga compatible string (ls1021a-qds)
 
 Fixes:
 - Change #io-channel-cells to 1 for voltage divider (imx6dl-plym2m)
 
 New features:
 - Describe Bluetooth controller (imx7d-pico)
 - Add power-supply to PCIe Root Port (imx6sx-sdb, imx6qdl-sabresd)
 -----BEGIN PGP SIGNATURE-----
 
 iQHFBAABCgAvFiEEJS45w2QNr0ezLVaoNF3oRQ23YkwFAmpqUe0RHGZyYW5rLmxp
 QG54cC5jb20ACgkQNF3oRQ23YkzaTgwAzcjgy6li8+Iy8VcXWRukvv8rjmMVj5BW
 GumyOumzaaynMXmbsH9EKXuvy4hil+UWYp0ED8cI73aWTjWN/RFeoYbeLdI4Kzj/
 4FmmnAXxrd1zt1hcwi0HdF4FAjgbN10sOYHHb3LlRu9MC7mOPPeM9VQ2fEC7J07n
 zOcbwTyRHBlUOELQtQQMOy8v0EQI9sCWkqIb5LbNsaNOvicv6/aZUA4RUS5VxIpl
 QJZznRX20lZ3uF9vISWAGjQ47kzh0h7wmSH2li7stzhF/m/JbZXynk95pW6/XjU6
 ds7CJLGS4fSce4VY7qSbs9FAWKRYZRCLViUI1QTYv3pn4q/34vEGy5G/B8nxnJAc
 UgIoUf7KNE1qZ4JvI2iJ8LzPDjj6S4uCs6YViW1kUn5UzAxchPUnePNR51B19kcY
 QI6GJKkb6TqtZsQq0iT5EUQOhSWBO+WYrnPWNWjdjLwIf4MmgA3vGaKWGHzI78P3
 pF8SMNywsZ2bvXz3crnM5D1ctmSKJq9Y
 =X3yF
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmprGBUACgkQmmx57+YA
 GNmM9A/9GoZ1Hc4j4ExwK+U5zovNyUv2PWoHqVQ5GeyZZDyXHCvm8i9yxCF0hZjT
 V1ZQ89RZHe4LVfU3rYr/vCLrMKWsJSLTcPiv3LEV9VPsLIDUWWxvnGw/VulZnEGE
 3rgf1zNhfVrU50p5fCrn36e3wQmOulULVbHOB1jhDdiHBv2ZjQYlWbIIawnErxLO
 kYCGvIoweXUd4dW2zZMK5ChZ0ShEb85aHX0acoZrgnf7WhqOfLJ6nO+lXvLr7G1V
 aw/VclaxKoBZovG/Z63sUEG6nDcpNCG58d+nONbTbEQub6BDfxxHnEimIrnBJ9kd
 paDyUdGKNuhwI48fKeb2bNIbIYSGFjkvrrfWkJi6EBwmqtGQgjeltXLpjE0sB0dm
 3zvDfTwP7M8pGGnKZgvApO9Np13paZWazNw1HtV2/hb8jltufbYfPn+WP5UU6mCt
 DY6DHX+WBfSHAMYMGcEu3W+iajSH63FujJNpFs8JZozSS6NE1I02VpjUoOnAiqoB
 gHJCn6yq6y5FV8FSYcDlakIPyvYH78n3K7wB6/lQQaFmWP6anQjMU5sguo5tNb/4
 WuJHQrtA5JSnD5a0a4h3rR2fSRwXB6MtH3adx6RPGIRSXm5qxnCegoJ+DGTO1H3M
 a/HB4Qsm1Nvl8681Gai9X4MoTLCgQ4zfw+LScWwj4/6xbAJrk5o=
 =48bC
 -----END PGP SIGNATURE-----

Merge tag 'imx-dt-7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux into soc/dt

ARM: dts: imx device tree updates for v7.3

Cleanup CHECK_DTBS warnings:
- Remove undocumented properties (nand-ecc-*, clock-names, default-state)
- Rename display@0 to display0 (ls1021a-iot)
- Add led suffix to node names (ls1021a-moxa-uc-8410a)
- Replace spansion,s25fl164k with jedec,spi-nor (ls1021a-moxa-uc-8410a)
- Use ethernet-phy-ieee802.3-c22 compatible string (ls1021a-moxa-uc-8410a)
- Rename eim-cs1 node to eim-cs1-bus (imx53-ard)
- Add power-supply for LCD panel (ls1021a-twr)
- Add fsl,ls1021aqds-fpga compatible string (ls1021a-qds)

Fixes:
- Change #io-channel-cells to 1 for voltage divider (imx6dl-plym2m)

New features:
- Describe Bluetooth controller (imx7d-pico)
- Add power-supply to PCIe Root Port (imx6sx-sdb, imx6qdl-sabresd)

* tag 'imx-dt-7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/frank.li/linux: (21 commits)
  ARM: dts: ls1021a-iot: rename display@0 to display0
  dt-bindings: display: imx: Add deprecated property display and display0
  ARM: dts: imx6ull-engicam-microgea: remove nand-ecc-strength and nand-ecc-step-size
  ARM: dts: imx6ul-isiot: remove undocument property clock-names of fsl,sgtl5000
  ARM: dts: imx53-smd: remove undocument property clock-names of ovti,ov5642
  ARM: dts: imx6dl-plym2m: change #io-channel-cells to 1 of voltage divider
  ARM: dts: ls1021a-moxa-uc-8410a: remove undocument property default-state of gpio-keys
  ARM: dts: ls1021a-moxa-uc-8410a: replace spansion,s25fl164k with jedec,spi-nor
  ARM: dts: ls1021a-moxa-uc-8410a: use compatible string ethernet-phy-ieee802.3-c22
  ARM: dts: ls1021a-twr: add power-supply for lcd panel
  ARM: dts: ls1021a-moxa-uc-8410a: add led suffix to fix CHECK_DTBS warnings
  ARM: dts: imx53-ard: change node name eim-cs1 to eim-cs1-bus
  dt-bindings: soc: imx: Add fsl,eim-bus
  ARM: dts: ls1021a-qds: add compatible string "fsl,ls1021aqds-fpga" for on boards FPGA chip
  dt-bindings: fsl,fpga-qixis: Add fsl,ls1021aqds-fpga compatible string
  ARM: dts: imx6qdl-tqma6: add nvmem-layout
  ARM: dts: imx6ul-tqma6ul: add nvmem-layout
  ARM: dts: imx6sx-sdb: Add power supply property to Root Port node
  ARM: dts: imx6qdl-sabresd: Add power supply property to Root Port node
  ARM: dts: nxp: ls: Correct indentation
  ...

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-07-30 11:23:18 +02:00
Arnd Bergmann
aa469c0c55 MediaTek SoC driver updates
This adds a fix for a missing error check in mtk-socinfo, and
 also a missing MODULE_DEVICE_TABLE() in the mtk-dvfsrc driver.
 
 Besides from that, this also reworks how the MMSYS tables are
 specified with the macro, separating the component's hardware
 instance from the actual type, resolving a prerequirement for
 the restructuring of mediatek-drm.
 -----BEGIN PGP SIGNATURE-----
 
 iLoEABYKAGIWIQQn3Xxr56ypAcSHzXSaNgTPrZeEeAUCamsBiRsUgAAAAAAEAA5t
 YW51MiwyLjUrMS4xMiwyLDIoHGFuZ2Vsb2dpb2FjY2hpbm8uZGVscmVnbm9AY29s
 bGFib3JhLmNvbQAKCRCaNgTPrZeEeFUuAQCcdpIBGxycSOIoG5uxijcx8w7uhmf9
 FJMPm4LiDF5LgwD/bn2CqDMCrkNQysoErQkhVlOczLbKJSQ69QGFuSGLlwo=
 =TyOH
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmprF7wACgkQmmx57+YA
 GNnb0BAAg54DnXer5nJLPZyqfKbgscGZbVLFW2X9k/Cx1utJpVW4ozxRCUTK4sb4
 15t+wUOSsdzj1ZIYCccZR3QtqBxbPRnLECHeP/tEqf0+4Qu0jOaYXIstIVsrInkr
 zDtXFReq0D+2V8Nf46gw7zi65q2xZUbNSeJTUgy3s5miOaB0w1/as6c97SJzzZgU
 DqLEmo/gi74+k3PfYcgLiJJXJSYba8qtGUorrJbXvil+wWPbcDIpokpt7V/ktGjE
 jVBdtHNR0IhpMZUjK/4CUi2EgQHpnGeSLN0je3O9PfdUVcIvauwd2Fy5RUSfOk8x
 Hs877b4OcJry+fAS1Hw+/v2f1nlMyMcfuPll+8GHkP11c511M55o3zbYR0RKlrtz
 DT12QiSTHyLir+4fdTyh808hBJw8B2CPt59AtHbTT1YNAFfqOmo/5EmYlCOIiFNk
 WRYz7lQRLY2ElOgUQAtmAS4LiPg7aen0bICIggFdK68abdUfon7oSanxkYxEL1By
 0+/fQMbOlotlJar5cyi5l1/bKshs8IIm/+aLXFsqtIBZHbKXo6Z9NXM3HDXOj1oK
 II+sfmw8GxfmGVQbLUCns3J4IlVUqndw10Bad8u2djLruWeL9AgfkRQZqOTEi1B2
 4BL6aB4H9Co0amwb1mPUFh7atfLgqaQkf623Lis6i+hqR5+4cGc=
 =Ew69
 -----END PGP SIGNATURE-----

Merge tag 'mtk-soc-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux into soc/drivers

MediaTek SoC driver updates

This adds a fix for a missing error check in mtk-socinfo, and
also a missing MODULE_DEVICE_TABLE() in the mtk-dvfsrc driver.

Besides from that, this also reworks how the MMSYS tables are
specified with the macro, separating the component's hardware
instance from the actual type, resolving a prerequirement for
the restructuring of mediatek-drm.

* tag 'mtk-soc-for-v7.3' of https://git.kernel.org/pub/scm/linux/kernel/git/mediatek/linux:
  soc: mediatek: add missing MODULE_DEVICE_TABLE()
  soc: mediatek: mtk-mmsys: Use MMSYS_ROUTE() in default routing table
  soc: mediatek: mtk-mmsys: Rework routes to specify component ID
  soc: mediatek: mtk-socinfo Add error handling in devm_kasprintf()

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
2026-07-30 11:21:59 +02:00
Fernando Fernandez Mancera
ac84c85518 ipv6: remove unnecessary reset of position pointer
The position pointer is only advanced if the return value of the proc
handler is positive at new_sync_write(). Therefore no need to manually
reset it when doing error handling.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20260727091834.6645-2-fmancera@suse.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:16:29 +02:00
Fernando Fernandez Mancera
ea771e17e9 ipv4: remove unnecessary reset of position pointer
The position pointer is only advanced if the return value of the proc
handler is positive at new_sync_write(). Therefore no need to manually
reset it when doing error handling.

Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Signed-off-by: Fernando Fernandez Mancera <fmancera@suse.de>
Link: https://patch.msgid.link/20260727091834.6645-1-fmancera@suse.de
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2026-07-30 11:16:29 +02:00
Li Xiasong
7e98f85639 mm/slub: fix missing debugfs entries for caches created before sysfs init
slab_debugfs_init() creates the slab debugfs root at device initcall
time, while slab_sysfs_init() moves slab_state to FULL at late initcall
time. SLAB_STORE_USER caches created in this window miss their debugfs
entries because do_kmem_cache_create() skips debugfs_slab_add() when
slab_state <= UP. This was observed with MPTCP's request_sock_subflow_v6
cache, whose slab debugfs directory was missing.

The affected window is:

  slab_debugfs_init()
    slab_debugfs_root = debugfs_create_dir(...)
    list_for_each_entry(s, &slab_caches, list)
      debugfs_slab_add(s)

  kmem_cache_create(..., SLAB_STORE_USER, ...)
    do_kmem_cache_create()
      if (slab_state <= UP)
        return without debugfs entries

  slab_sysfs_init()
    slab_state = FULL

Initialize the debugfs root and add debugfs entries while holding
slab_mutex, walking slab_caches exactly once and handling both sysfs
and debugfs entries in the same pass. This gives the sysfs and debugfs
initialization an explicit order and prevents caches from being
created between the debugfs scan and slab_state reaching FULL.

Gate the new slab_late_init() on either sysfs or debugfs being enabled,
with the slab_kset creation and alias_list processing factored into
helpers that have empty no-sysfs variants, as suggested by Vlastimil
Babka. On slab_kset_init() failure, slab_state stays below FULL so
kmem_cache_create() keeps taking the early-boot path, matching prior
behavior.

Guard debugfs_slab_release() against an uninitialized debugfs root,
since the root is now created later and a cache may be released before
it exists.

Fixes: 1a5ad30b89 ("mm: slub: make slab_sysfs_init() a late_initcall")
Cc: stable@vger.kernel.org
Suggested-by: Vlastimil Babka <vbabka@kernel.org>
Signed-off-by: Li Xiasong <lixiasong1@huawei.com>
Link: https://patch.msgid.link/20260729101849.3734287-1-lixiasong1@huawei.com
Reviewed-by: Harry Yoo (Oracle) <harry@kernel.org>
Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
2026-07-30 11:14:57 +02:00