Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
4a0d561
netfilter: nf_tables: release flowtable after rcu grace period on error
PlaidCat Jun 2, 2026
20b3f4f
can: j1939: j1939_session_new(): fix skb reference counting
PlaidCat Jun 2, 2026
91fdc55
ima: don't clear IMA_DIGSIG flag when setting or removing non-IMA xattr
PlaidCat Jun 2, 2026
a674d76
netfilter: nf_conntrack_h323: check for zero length in DecodeQ931()
PlaidCat Jun 2, 2026
0fc3a78
Revert "scsi: lpfc: Update lpfc version to 14.4.0.12"
PlaidCat Jun 2, 2026
803433b
Revert "scsi: lpfc: Add capability to register Platform Name ID to fa…
PlaidCat Jun 2, 2026
605de60
Revert "scsi: lpfc: Allow support for BB credit recovery in point-to-…
PlaidCat Jun 2, 2026
798d1aa
Revert "scsi: lpfc: Fix reusing an ndlp that is marked NLP_DROPPED du…
PlaidCat Jun 2, 2026
13243ee
Revert "scsi: lpfc: Modify kref handling for Fabric Controller ndlps"
PlaidCat Jun 2, 2026
b80b65a
Revert "scsi: lpfc: Fix leaked ndlp krefs when in point-to-point topo…
PlaidCat Jun 2, 2026
c246c1c
Revert "scsi: lpfc: Ensure unregistration of rpis for received PLOGIs"
PlaidCat Jun 2, 2026
b430a06
Revert "scsi: lpfc: Remove redundant NULL ptr assignment in lpfc_els_…
PlaidCat Jun 2, 2026
33246c8
Revert "scsi: lpfc: Revise discovery related function headers and com…
PlaidCat Jun 2, 2026
7c9494d
Revert "scsi: lpfc: Update various NPIV diagnostic log messaging"
PlaidCat Jun 2, 2026
f42329a
Revert "scsi: lpfc: Copyright updates for 14.4.0.11 patches"
PlaidCat Jun 2, 2026
a7a3bb3
Revert "scsi: lpfc: Update lpfc version to 14.4.0.11"
PlaidCat Jun 2, 2026
57d0353
Revert "scsi: lpfc: Convert debugfs directory counts from atomic to u…
PlaidCat Jun 2, 2026
56972ca
Revert "scsi: lpfc: Clean up extraneous phba dentries"
PlaidCat Jun 2, 2026
cfbcb15
Revert "scsi: lpfc: Use switch case statements in DIF debugfs handlers"
PlaidCat Jun 2, 2026
f671435
Revert "scsi: lpfc: Fix memory leak when nvmeio_trc debugfs entry is …
PlaidCat Jun 2, 2026
3d56fd4
Revert "scsi: lpfc: Define size of debugfs entry for xri rebalancing"
PlaidCat Jun 2, 2026
e0d19e7
Revert "scsi: lpfc: Ensure PLOGI_ACC is sent prior to PRLI in Point t…
PlaidCat Jun 2, 2026
90af12a
Revert "scsi: lpfc: Check return status of lpfc_reset_flush_io_contex…
PlaidCat Jun 2, 2026
813cee7
Revert "scsi: lpfc: Decrement ndlp kref after FDISC retries exhausted"
PlaidCat Jun 2, 2026
0a7c56c
Revert "scsi: lpfc: Remove ndlp kref decrement clause for F_Port_Ctrl…
PlaidCat Jun 2, 2026
bdde2e7
Revert "scsi: lpfc: Clean up allocated queues when queue setup mbox c…
PlaidCat Jun 2, 2026
ee57620
Revert "scsi: lpfc: Abort outstanding ELS WQEs regardless of if rmmod…
PlaidCat Jun 2, 2026
0e5869b
Revert "scsi: lpfc: Remove unused member variables in struct lpfc_hba…
PlaidCat Jun 2, 2026
c569c56
Revert "scsi: lpfc: Use int type to store negative error codes"
PlaidCat Jun 2, 2026
270b10a
Revert "scsi: lpfc: use min() to improve code"
PlaidCat Jun 2, 2026
6c0230b
Revert "scsi: lpfc: Fix wrong function reference in a comment"
PlaidCat Jun 2, 2026
da2d044
Revert "lpfc: don't use file->f_path.dentry for comparisons"
PlaidCat Jun 2, 2026
57b03d1
Revert "scsi: lpfc: Copyright updates for 14.4.0.10 patches"
PlaidCat Jun 2, 2026
aa4f0a2
Revert "scsi: lpfc: Update lpfc version to 14.4.0.10"
PlaidCat Jun 2, 2026
5f98866
Revert "scsi: lpfc: Modify end-of-life adapters' model descriptions"
PlaidCat Jun 2, 2026
8b4c383
Revert "scsi: lpfc: Revise CQ_CREATE_SET mailbox bitfield definitions"
PlaidCat Jun 2, 2026
09b3f93
Revert "scsi: lpfc: Move clearing of HBA_SETUP flag to before lpfc_sl…
PlaidCat Jun 2, 2026
8d15904
Revert "scsi: lpfc: Ensure HBA_SETUP flag is used only for SLI4 in de…
PlaidCat Jun 2, 2026
3ad92b2
Revert "scsi: lpfc: Relocate clearing initial phba flags from link up…
PlaidCat Jun 2, 2026
1514acb
Revert "scsi: lpfc: Simplify error handling for failed lpfc_get_sli4_…
PlaidCat Jun 2, 2026
89c1cbc
Revert "scsi: lpfc: Early return out of FDMI cmpl for locally rejecte…
PlaidCat Jun 2, 2026
f541f62
Revert "scsi: lpfc: Skip RSCN processing when FC_UNLOADING flag is set"
PlaidCat Jun 2, 2026
f28fc3e
Revert "scsi: lpfc: Check for hdwq null ptr when cleaning up lpfc_vpo…
PlaidCat Jun 2, 2026
9d8bd2c
Revert "scsi: lpfc: Update debugfs trace ring initialization messages"
PlaidCat Jun 2, 2026
d34c5bb
Revert "scsi: lpfc: Revise logging format for failed CT MIB requests"
PlaidCat Jun 2, 2026
c1e8794
drm/mgag200: fix mgag200_bmc_stop_scanout()
PlaidCat Jun 2, 2026
d4dc945
net: sched: act_csum: validate nested VLAN headers
PlaidCat Jun 2, 2026
69a0375
netfilter: ip6t_eui64: reject invalid MAC header for all packets
PlaidCat Jun 2, 2026
c71cde2
cifs: remove unnecessary tracing after put tcon
PlaidCat Jun 2, 2026
2603ac9
cifs: make default value of retrans as zero
PlaidCat Jun 2, 2026
52f83e3
dpll: zl3073x: Add output pin frequency helper
PlaidCat Jun 2, 2026
fb23895
dpll: zl3073x: Include current frequency in supported frequencies list
PlaidCat Jun 2, 2026
061f96b
dpll: zl3073x: Fix ref frequency setting
PlaidCat Jun 2, 2026
72d9547
dpll: zl3073x: fix REF_PHASE_OFFSET_COMP register width for some chip…
PlaidCat Jun 2, 2026
9fada6b
dpll: zl3073x: Remove redundant cleanup in devm_dpll_init()
PlaidCat Jun 2, 2026
971596d
io_uring/rsrc: reject zero-length fixed buffer import
PlaidCat Jun 2, 2026
d16fdab
netfilter: nf_conntrack_helper: pass helper to expect cleanup
PlaidCat Jun 2, 2026
252399f
HID: wacom: fix out-of-bounds read in wacom_intuos_bt_irq
PlaidCat Jun 2, 2026
8aa946d
wifi: brcmfmac: validate bsscfg indices in IF events
PlaidCat Jun 2, 2026
ba95d9e
netfilter: ctnetlink: ensure safe access to master conntrack
PlaidCat Jun 2, 2026
635264c
netfilter: xt_tcpmss: check remaining length before reading optlen
PlaidCat Jun 2, 2026
40f50d1
net: Fix rcu_tasks stall in threaded busypoll
PlaidCat Jun 2, 2026
62bf558
ice: use netif_get_num_default_rss_queues()
PlaidCat Jun 2, 2026
8c15bac
ice: set max queues in alloc_etherdev_mqs()
PlaidCat Jun 2, 2026
3d4e6ea
anon_inode: use a proper mode internally
PlaidCat Jun 2, 2026
16d0260
pidfs: use anon_inode_getattr()
PlaidCat Jun 2, 2026
6330cb0
anon_inode: explicitly block ->setattr()
PlaidCat Jun 2, 2026
5cd8d4d
pidfs: use anon_inode_setattr()
PlaidCat Jun 2, 2026
1564b38
anon_inode: raise SB_I_NODEV and SB_I_NOEXEC
PlaidCat Jun 2, 2026
d12294f
fs: add S_ANON_INODE
PlaidCat Jun 2, 2026
620a079
mm: thp: deny THP for files on anonymous inodes
PlaidCat Jun 2, 2026
013cbc3
dpaa2-switch: prevent ZERO_SIZE_PTR dereference when num_ifs is zero
PlaidCat Jun 2, 2026
9c16df1
dpaa2-switch: validate num_ifs to prevent out-of-bounds write
PlaidCat Jun 2, 2026
3a154f3
mm/page_alloc: clear page->private in free_pages_prepare()
PlaidCat Jun 2, 2026
35d3eca
dm-thin: fix metadata refcount underflow
PlaidCat Jun 2, 2026
2118d47
crypto: tegra - Disable softirqs before finalizing request
PlaidCat Jun 2, 2026
3eb9131
Bluetooth: MGMT: validate LTK enc_size on load
PlaidCat Jun 2, 2026
88994d3
Bluetooth: SCO: fix race conditions in sco_sock_connect()
PlaidCat Jun 2, 2026
11265cb
xfs: delete attr leaf freemap entries when empty
PlaidCat Jun 2, 2026
66c905b
xfs: fix freemap adjustments when adding xattrs to leaf blocks
PlaidCat Jun 2, 2026
bda6623
Rebuild rocky10_2 with kernel-6.12.0-211.18.1.el10_2
PlaidCat Jun 2, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion Makefile.rhelver
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ RHEL_MINOR = 2
#
# Use this spot to avoid future merge conflicts.
# Do not trim this comment.
RHEL_RELEASE = 211.16.1
RHEL_RELEASE = 211.18.1

#
# RHEL_REBASE_NUM
Expand Down
170 changes: 170 additions & 0 deletions ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/19bbfe7b.failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
fs: add S_ANON_INODE

jira KERNEL-1029
Rebuild_History Non-Buildable kernel-6.12.0-211.18.1.el10_2
commit-author Christian Brauner <brauner@kernel.org>
commit 19bbfe7b5fcc04d8711e8e1352acc77c1a5c3955
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
Will be included in final tarball splat. Ref for failed cherry-pick at:
ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/19bbfe7b.failed

This makes it easy to detect proper anonymous inodes and to ensure that
we can detect them in codepaths such as readahead().

Readahead on anonymous inodes didn't work because they didn't have a
proper mode. Now that they have we need to retain EINVAL being returned
otherwise LTP will fail.

We also need to ensure that ioctls aren't simply fired like they are for
regular files so things like inotify inodes continue to correctly call
their own ioctl handlers as in [1].

Reported-by: Xilin Wu <sophon@radxa.com>
Link: https://lore.kernel.org/3A9139D5CD543962+89831381-31b9-4392-87ec-a84a5b3507d8@radxa.com [1]
Link: https://lore.kernel.org/7a1a7076-ff6b-4cb0-94e7-7218a0a44028@sirena.org.uk
Signed-off-by: Christian Brauner <brauner@kernel.org>
(cherry picked from commit 19bbfe7b5fcc04d8711e8e1352acc77c1a5c3955)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>

# Conflicts:
# mm/readahead.c
diff --cc mm/readahead.c
index 2dbe5993b6aa,20d36d6b055e..000000000000
--- a/mm/readahead.c
+++ b/mm/readahead.c
@@@ -678,29 -690,34 +678,55 @@@ EXPORT_SYMBOL_GPL(page_cache_async_ra)

ssize_t ksys_readahead(int fd, loff_t offset, size_t count)
{
++<<<<<<< HEAD
+ ssize_t ret;
+ struct fd f;
+
+ ret = -EBADF;
+ f = fdget(fd);
+ if (!fd_file(f) || !(fd_file(f)->f_mode & FMODE_READ))
+ goto out;
++=======
+ struct file *file;
+ const struct inode *inode;
+
+ CLASS(fd, f)(fd);
+ if (fd_empty(f))
+ return -EBADF;
+
+ file = fd_file(f);
+ if (!(file->f_mode & FMODE_READ))
+ return -EBADF;
++>>>>>>> 19bbfe7b5fcc (fs: add S_ANON_INODE)

/*
* The readahead() syscall is intended to run only on files
* that can execute readahead. If readahead is not possible
* on this file, then we must return -EINVAL.
*/
++<<<<<<< HEAD
+ ret = -EINVAL;
+ if (!fd_file(f)->f_mapping || !fd_file(f)->f_mapping->a_ops ||
+ (!S_ISREG(file_inode(fd_file(f))->i_mode) &&
+ !S_ISBLK(file_inode(fd_file(f))->i_mode)))
+ goto out;
++=======
+ if (!file->f_mapping)
+ return -EINVAL;
+ if (!file->f_mapping->a_ops)
+ return -EINVAL;
+
+ inode = file_inode(file);
+ if (!S_ISREG(inode->i_mode) && !S_ISBLK(inode->i_mode))
+ return -EINVAL;
+ if (IS_ANON_FILE(inode))
+ return -EINVAL;
++>>>>>>> 19bbfe7b5fcc (fs: add S_ANON_INODE)

- return vfs_fadvise(fd_file(f), offset, count, POSIX_FADV_WILLNEED);
+ ret = vfs_fadvise(fd_file(f), offset, count, POSIX_FADV_WILLNEED);
+out:
+ fdput(f);
+ return ret;
}

SYSCALL_DEFINE3(readahead, int, fd, loff_t, offset, size_t, count)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 6e0c954388d4..4dbd5627af8f 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -822,7 +822,8 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd,
return ioctl_fioasync(fd, filp, argp);

case FIOQSIZE:
- if (S_ISDIR(inode->i_mode) || S_ISREG(inode->i_mode) ||
+ if (S_ISDIR(inode->i_mode) ||
+ (S_ISREG(inode->i_mode) && !IS_ANON_FILE(inode)) ||
S_ISLNK(inode->i_mode)) {
loff_t res = inode_get_bytes(inode);
return copy_to_user(argp, &res, sizeof(res)) ?
@@ -857,7 +858,7 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd,
return ioctl_file_dedupe_range(filp, argp);

case FIONREAD:
- if (!S_ISREG(inode->i_mode))
+ if (!S_ISREG(inode->i_mode) || IS_ANON_FILE(inode))
return vfs_ioctl(filp, cmd, arg);

return put_user(i_size_read(inode) - filp->f_pos,
@@ -882,7 +883,7 @@ static int do_vfs_ioctl(struct file *filp, unsigned int fd,
return ioctl_get_fs_sysfs_path(filp, argp);

default:
- if (S_ISREG(inode->i_mode))
+ if (S_ISREG(inode->i_mode) && !IS_ANON_FILE(inode))
return file_ioctl(filp, cmd, argp);
break;
}
diff --git a/fs/libfs.c b/fs/libfs.c
index 7fd661bb935f..df9a2f4472f7 100644
--- a/fs/libfs.c
+++ b/fs/libfs.c
@@ -1654,7 +1654,7 @@ struct inode *alloc_anon_inode(struct super_block *s)
inode->i_mode = S_IRUSR | S_IWUSR;
inode->i_uid = current_fsuid();
inode->i_gid = current_fsgid();
- inode->i_flags |= S_PRIVATE;
+ inode->i_flags |= S_PRIVATE | S_ANON_INODE;
simple_inode_init_ts(inode);
return inode;
}
diff --git a/fs/pidfs.c b/fs/pidfs.c
index d6c0ed79ea24..7e10fac8e623 100644
--- a/fs/pidfs.c
+++ b/fs/pidfs.c
@@ -804,7 +804,7 @@ static int pidfs_init_inode(struct inode *inode, void *data)
const struct pid *pid = data;

inode->i_private = data;
- inode->i_flags |= S_PRIVATE;
+ inode->i_flags |= S_PRIVATE | S_ANON_INODE;
inode->i_mode |= S_IRWXU;
inode->i_op = &pidfs_inode_operations;
inode->i_fop = &pidfs_file_operations;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 106b644cee85..af426a3bd89c 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2319,6 +2319,7 @@ struct super_operations {
#define S_CASEFOLD (1 << 15) /* Casefolded file */
#define S_VERITY (1 << 16) /* Verity file (using fs/verity/) */
#define S_KERNEL_FILE (1 << 17) /* File is in use by the kernel (eg. fs/cachefiles) */
+#define S_ANON_INODE (1 << 19) /* Inode is an anonymous inode */

/*
* Note that nosuid etc flags are inode-specific: setting some file-system
@@ -2375,6 +2376,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags

#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
(inode)->i_rdev == WHITEOUT_DEV)
+#define IS_ANON_FILE(inode) ((inode)->i_flags & S_ANON_INODE)

static inline bool HAS_UNMAPPED_ID(struct mnt_idmap *idmap,
struct inode *inode)
* Unmerged path mm/readahead.c
133 changes: 133 additions & 0 deletions ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/22bdf3d6.failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
anon_inode: explicitly block ->setattr()

jira KERNEL-1029
Rebuild_History Non-Buildable kernel-6.12.0-211.18.1.el10_2
commit-author Christian Brauner <brauner@kernel.org>
commit 22bdf3d6581af6d06ed8a46c6835648421cca0ea
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
Will be included in final tarball splat. Ref for failed cherry-pick at:
ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/22bdf3d6.failed

It is currently possible to change the mode and owner of the single
anonymous inode in the kernel:

int main(int argc, char *argv[])
{
int ret, sfd;
sigset_t mask;
struct signalfd_siginfo fdsi;

sigemptyset(&mask);
sigaddset(&mask, SIGINT);
sigaddset(&mask, SIGQUIT);

ret = sigprocmask(SIG_BLOCK, &mask, NULL);
if (ret < 0)
_exit(1);

sfd = signalfd(-1, &mask, 0);
if (sfd < 0)
_exit(2);

ret = fchown(sfd, 5555, 5555);
if (ret < 0)
_exit(3);

ret = fchmod(sfd, 0777);
if (ret < 0)
_exit(3);

_exit(4);
}

This is a bug. It's not really a meaningful one because anonymous inodes
don't really figure into path lookup and they cannot be reopened via
/proc/<pid>/fd/<nr> and can't be used for lookup itself. So they can
only ever serve as direct references.

But it is still completely bogus to allow the mode and ownership or any
of the properties of the anonymous inode to be changed. Block this!

Link: https://lore.kernel.org/20250407-work-anon_inode-v1-3-53a44c20d44e@kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Cc: stable@vger.kernel.org # all LTS kernels
Signed-off-by: Christian Brauner <brauner@kernel.org>
(cherry picked from commit 22bdf3d6581af6d06ed8a46c6835648421cca0ea)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>

# Conflicts:
# fs/anon_inodes.c
# fs/internal.h
diff --cc fs/anon_inodes.c
index 5a070be69922,cb51a90bece0..000000000000
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@@ -28,6 -30,45 +28,48 @@@ static struct vfsmount *anon_inode_mnt
static struct inode *anon_inode_inode __ro_after_init;

/*
++<<<<<<< HEAD
++=======
+ * User space expects anonymous inodes to have no file type in st_mode.
+ *
+ * In particular, 'lsof' has this legacy logic:
+ *
+ * type = s->st_mode & S_IFMT;
+ * switch (type) {
+ * ...
+ * case 0:
+ * if (!strcmp(p, "anon_inode"))
+ * Lf->ntype = Ntype = N_ANON_INODE;
+ *
+ * to detect our old anon_inode logic.
+ *
+ * Rather than mess with our internal sane inode data, just fix it
+ * up here in getattr() by masking off the format bits.
+ */
+ int anon_inode_getattr(struct mnt_idmap *idmap, const struct path *path,
+ struct kstat *stat, u32 request_mask,
+ unsigned int query_flags)
+ {
+ struct inode *inode = d_inode(path->dentry);
+
+ generic_fillattr(&nop_mnt_idmap, request_mask, inode, stat);
+ stat->mode &= ~S_IFMT;
+ return 0;
+ }
+
+ int anon_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct iattr *attr)
+ {
+ return -EOPNOTSUPP;
+ }
+
+ static const struct inode_operations anon_inode_operations = {
+ .getattr = anon_inode_getattr,
+ .setattr = anon_inode_setattr,
+ };
+
+ /*
++>>>>>>> 22bdf3d6581a (anon_inode: explicitly block ->setattr())
* anon_inodefs_dname() is called from d_path().
*/
static char *anon_inodefs_dname(struct dentry *dentry, char *buffer, int buflen)
diff --cc fs/internal.h
index b555366c7974,f545400ce607..000000000000
--- a/fs/internal.h
+++ b/fs/internal.h
@@@ -338,3 -341,10 +338,13 @@@ static inline bool path_mounted(const s
return path->mnt->mnt_root == path->dentry;
}
void file_f_owner_release(struct file *file);
++<<<<<<< HEAD
++=======
+ bool file_seek_cur_needs_f_lock(struct file *file);
+ int statmount_mnt_idmap(struct mnt_idmap *idmap, struct seq_file *seq, bool uid_map);
+ int anon_inode_getattr(struct mnt_idmap *idmap, const struct path *path,
+ struct kstat *stat, u32 request_mask,
+ unsigned int query_flags);
+ int anon_inode_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
+ struct iattr *attr);
++>>>>>>> 22bdf3d6581a (anon_inode: explicitly block ->setattr())
* Unmerged path fs/anon_inodes.c
* Unmerged path fs/internal.h
70 changes: 70 additions & 0 deletions ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/ac1ea219.failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
mm/page_alloc: clear page->private in free_pages_prepare()

jira KERNEL-1029
cve CVE-2026-43303
Rebuild_History Non-Buildable kernel-6.12.0-211.18.1.el10_2
commit-author Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
commit ac1ea219590c09572ed5992dc233bbf7bb70fef9
Empty-Commit: Cherry-Pick Conflicts during history rebuild.
Will be included in final tarball splat. Ref for failed cherry-pick at:
ciq/ciq_backports/kernel-6.12.0-211.18.1.el10_2/ac1ea219.failed

Several subsystems (slub, shmem, ttm, etc.) use page->private but don't
clear it before freeing pages. When these pages are later allocated as
high-order pages and split via split_page(), tail pages retain stale
page->private values.

This causes a use-after-free in the swap subsystem. The swap code uses
page->private to track swap count continuations, assuming freshly
allocated pages have page->private == 0. When stale values are present,
swap_count_continued() incorrectly assumes the continuation list is valid
and iterates over uninitialized page->lru containing LIST_POISON values,
causing a crash:

KASAN: maybe wild-memory-access in range [0xdead000000000100-0xdead000000000107]
RIP: 0010:__do_sys_swapoff+0x1151/0x1860

Fix this by clearing page->private in free_pages_prepare(), ensuring all
freed pages have clean state regardless of previous use.

Link: https://lkml.kernel.org/r/20260207173615.146159-1-mikhail.v.gavrilov@gmail.com
Fixes: 3b8000ae185c ("mm/vmalloc: huge vmalloc backing pages should be split rather than compound")
Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Suggested-by: Zi Yan <ziy@nvidia.com>
Acked-by: Zi Yan <ziy@nvidia.com>
Acked-by: David Hildenbrand (Arm) <david@kernel.org>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Brendan Jackman <jackmanb@google.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Kairui Song <ryncsn@gmail.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Nicholas Piggin <npiggin@gmail.com>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
(cherry picked from commit ac1ea219590c09572ed5992dc233bbf7bb70fef9)
Signed-off-by: Jonathan Maple <jmaple@ciq.com>

# Conflicts:
# mm/page_alloc.c
diff --cc mm/page_alloc.c
index 373e0e4bb3d2,77dcec36946f..000000000000
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@@ -1134,7 -1428,8 +1134,12 @@@ __always_inline bool free_pages_prepare
}

page_cpupid_reset_last(page);
++<<<<<<< HEAD
+ page->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;
++=======
+ page->flags.f &= ~PAGE_FLAGS_CHECK_AT_PREP;
+ page->private = 0;
++>>>>>>> ac1ea219590c (mm/page_alloc: clear page->private in free_pages_prepare())
reset_page_owner(page, order);
page_table_check_free(page, order);
pgalloc_tag_sub(page, 1 << order);
* Unmerged path mm/page_alloc.c
Loading
Loading