Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
a606c5f
PCI: Support BAR sizes up to 8TB
PlaidCat Oct 3, 2025
03a28e1
net: usb: smsc75xx: Limit packet length to skb->len
PlaidCat Oct 3, 2025
c00c6da
net: usb: smsc75xx: Move packet length check to prevent kernel panic …
PlaidCat Oct 3, 2025
b65cde4
xfs: handle nimaps=0 from xfs_bmapi_write in xfs_alloc_file_space
PlaidCat Oct 3, 2025
bad4807
xfs: fix error returns from xfs_bmapi_write
PlaidCat Oct 3, 2025
cc09103
vmxnet3: disable rx data ring on dma allocation failure
PlaidCat Oct 3, 2025
480877f
tracing: Disable interrupt or preemption before acquiring arch_spinlo…
PlaidCat Oct 3, 2025
fbe9e9b
drm/gem: Acquire references on GEM handles for framebuffers
PlaidCat Oct 3, 2025
743695c
drm/framebuffer: Acquire internal references on GEM handles
PlaidCat Oct 3, 2025
77ea26c
idpf: convert control queue mutex to a spinlock
PlaidCat Oct 3, 2025
e4960e7
net_sched: ets: fix a race in ets_qdisc_change()
PlaidCat Oct 3, 2025
bc29f47
net_sched: sch_ets: implement lockless ets_dump()
PlaidCat Oct 3, 2025
c0213bf
net/sched: ets: use old 'nbands' while purging unused classes
PlaidCat Oct 3, 2025
b21560f
Revert "module, async: async_synchronize_full() on module init iff as…
PlaidCat Oct 3, 2025
f8283d0
vsock: Fix transport_* TOCTOU
PlaidCat Oct 3, 2025
ac8fa4e
xfs: make sure sb_fdblocks is non-negative
PlaidCat Oct 3, 2025
cce40d8
do_change_type(): refuse to operate on unmounted/not ours mounts
PlaidCat Oct 3, 2025
69942e7
use uniform permission checks for all mount propagation changes
PlaidCat Oct 3, 2025
12d8cbb
HID: core: fix shift-out-of-bounds in hid_report_raw_event
PlaidCat Oct 3, 2025
0b37d9c
HID: simplify snto32()
PlaidCat Oct 3, 2025
14d11ba
HID: stop exporting hid_snto32()
PlaidCat Oct 3, 2025
2706687
HID: core: Harden s32ton() against conversion to 0 bits
PlaidCat Oct 3, 2025
38f3196
Rebuild rocky8_10 with kernel-4.18.0-553.76.1.el8_10
PlaidCat Oct 3, 2025
603ad23
nfsd: don't ignore the return code of svc_proc_register()
PlaidCat Oct 3, 2025
3136b9e
firmware: arm_scpi: Ensure scpi_info is not assigned if the probe fails
PlaidCat Oct 3, 2025
f783f9f
sctp: linearize cloned gso packets in sctp_rcv
PlaidCat Oct 3, 2025
a32b08c
net: openvswitch: Fix the dead loop of MPLS parse
PlaidCat Oct 3, 2025
2afe456
net_sched: hfsc: Fix a UAF vulnerability in class handling
PlaidCat Oct 3, 2025
cb0160d
net_sched: hfsc: Fix a potential UAF in hfsc_dequeue() too
PlaidCat Oct 3, 2025
9adc78b
Rebuild rocky8_10 with kernel-4.18.0-553.77.1.el8_10
PlaidCat Oct 3, 2025
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
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 = 10
#
# Use this spot to avoid future merge conflicts.
# Do not trim this comment.
RHEL_RELEASE = 553.74.1
RHEL_RELEASE = 553.77.1

#
# ZSTREAM
Expand Down
83 changes: 83 additions & 0 deletions ciq/ciq_backports/kernel-4.18.0-553.76.1.el8_10/58f88071.failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
xfs: make sure sb_fdblocks is non-negative

jira LE-4321
Rebuild_History Non-Buildable kernel-4.18.0-553.76.1.el8_10
commit-author Wengang Wang <[email protected]>
commit 58f880711f2ba53fd5e959875aff5b3bf6d5c32e
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-4.18.0-553.76.1.el8_10/58f88071.failed

A user with a completely full filesystem experienced an unexpected
shutdown when the filesystem tried to write the superblock during
runtime.
kernel shows the following dmesg:

[ 8.176281] XFS (dm-4): Metadata corruption detected at xfs_sb_write_verify+0x60/0x120 [xfs], xfs_sb block 0x0
[ 8.177417] XFS (dm-4): Unmount and run xfs_repair
[ 8.178016] XFS (dm-4): First 128 bytes of corrupted metadata buffer:
[ 8.178703] 00000000: 58 46 53 42 00 00 10 00 00 00 00 00 01 90 00 00 XFSB............
[ 8.179487] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
[ 8.180312] 00000020: cf 12 dc 89 ca 26 45 29 92 e6 e3 8d 3b b8 a2 c3 .....&E)....;...
[ 8.181150] 00000030: 00 00 00 00 01 00 00 06 00 00 00 00 00 00 00 80 ................
[ 8.182003] 00000040: 00 00 00 00 00 00 00 81 00 00 00 00 00 00 00 82 ................
[ 8.182004] 00000050: 00 00 00 01 00 64 00 00 00 00 00 04 00 00 00 00 .....d..........
[ 8.182004] 00000060: 00 00 64 00 b4 a5 02 00 02 00 00 08 00 00 00 00 ..d.............
[ 8.182005] 00000070: 00 00 00 00 00 00 00 00 0c 09 09 03 17 00 00 19 ................
[ 8.182008] XFS (dm-4): Corruption of in-memory data detected. Shutting down filesystem
[ 8.182010] XFS (dm-4): Please unmount the filesystem and rectify the problem(s)

When xfs_log_sb writes super block to disk, b_fdblocks is fetched from
m_fdblocks without any lock. As m_fdblocks can experience a positive ->
negative -> positive changing when the FS reaches fullness (see
xfs_mod_fdblocks). So there is a chance that sb_fdblocks is negative, and
because sb_fdblocks is type of unsigned long long, it reads super big.
And sb_fdblocks being bigger than sb_dblocks is a problem during log
recovery, xfs_validate_sb_write() complains.

Fix:
As sb_fdblocks will be re-calculated during mount when lazysbcount is
enabled, We just need to make xfs_validate_sb_write() happy -- make sure
sb_fdblocks is not nenative. This patch also takes care of other percpu
counters in xfs_log_sb.

Signed-off-by: Wengang Wang <[email protected]>
Reviewed-by: Darrick J. Wong <[email protected]>
Signed-off-by: Chandan Babu R <[email protected]>
(cherry picked from commit 58f880711f2ba53fd5e959875aff5b3bf6d5c32e)
Signed-off-by: Jonathan Maple <[email protected]>

# Conflicts:
# fs/xfs/libxfs/xfs_sb.c
diff --cc fs/xfs/libxfs/xfs_sb.c
index 6b7f3754a5e2,6b56f0f6d4c1..000000000000
--- a/fs/xfs/libxfs/xfs_sb.c
+++ b/fs/xfs/libxfs/xfs_sb.c
@@@ -800,13 -1031,19 +800,19 @@@ xfs_log_sb
* reservations that have been taken out percpu counters. If we have an
* unclean shutdown, this will be corrected by log recovery rebuilding
* the counters from the AGF block counts.
- *
- * Do not update sb_frextents here because it is not part of the lazy
- * sb counters, despite having a percpu counter. It is always kept
- * consistent with the ondisk rtbitmap by xfs_trans_apply_sb_deltas()
- * and hence we don't need have to update it here.
*/
++<<<<<<< HEAD
+ if (xfs_sb_version_haslazysbcount(&mp->m_sb)) {
+ mp->m_sb.sb_icount = percpu_counter_sum(&mp->m_icount);
++=======
+ if (xfs_has_lazysbcount(mp)) {
+ mp->m_sb.sb_icount = percpu_counter_sum_positive(&mp->m_icount);
++>>>>>>> 58f880711f2b (xfs: make sure sb_fdblocks is non-negative)
mp->m_sb.sb_ifree = min_t(uint64_t,
- percpu_counter_sum(&mp->m_ifree),
+ percpu_counter_sum_positive(&mp->m_ifree),
mp->m_sb.sb_icount);
- mp->m_sb.sb_fdblocks = percpu_counter_sum(&mp->m_fdblocks);
+ mp->m_sb.sb_fdblocks =
+ percpu_counter_sum_positive(&mp->m_fdblocks);
}

xfs_sb_to_disk(bp->b_addr, &mp->m_sb);
* Unmerged path fs/xfs/libxfs/xfs_sb.c
277 changes: 277 additions & 0 deletions ciq/ciq_backports/kernel-4.18.0-553.76.1.el8_10/6773da87.failed
Original file line number Diff line number Diff line change
@@ -0,0 +1,277 @@
xfs: fix error returns from xfs_bmapi_write

jira LE-4321
Rebuild_History Non-Buildable kernel-4.18.0-553.76.1.el8_10
commit-author Christoph Hellwig <[email protected]>
commit 6773da870ab89123d1b513da63ed59e32a29cb77
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-4.18.0-553.76.1.el8_10/6773da87.failed

xfs_bmapi_write can return 0 without actually returning a mapping in
mval in two different cases:

1) when there is absolutely no space available to do an allocation
2) when converting delalloc space, and the allocation is so small
that it only covers parts of the delalloc extent before the
range requested by the caller

Callers at best can handle one of these cases, but in many cases can't
cope with either one. Switch xfs_bmapi_write to always return a
mapping or return an error code instead. For case 1) above ENOSPC is
the obvious choice which is very much what the callers expect anyway.
For case 2) there is no really good error code, so pick a funky one
from the SysV streams portfolio.

This fixes the reproducer here:

https://lore.kernel.org/linux-xfs/CAEJPjCvT3Uag-pMTYuigEjWZHn1sGMZ0GCjVVCv29tNHK76Cgg@mail.gmail.com0/

which uses reserved blocks to create file systems that are gravely
out of space and thus cause at least xfs_file_alloc_space to hang
and trigger the lack of ENOSPC handling in xfs_dquot_disk_alloc.

Note that this patch does not actually make any caller but
xfs_alloc_file_space deal intelligently with case 2) above.

Signed-off-by: Christoph Hellwig <[email protected]>
Reported-by: 刘通 <[email protected]>
Reviewed-by: "Darrick J. Wong" <[email protected]>
Signed-off-by: Chandan Babu R <[email protected]>
(cherry picked from commit 6773da870ab89123d1b513da63ed59e32a29cb77)
Signed-off-by: Jonathan Maple <[email protected]>

# Conflicts:
# fs/xfs/libxfs/xfs_bmap.c
# fs/xfs/scrub/quota_repair.c
# fs/xfs/scrub/rtbitmap_repair.c
# fs/xfs/xfs_iomap.c
diff --cc fs/xfs/libxfs/xfs_bmap.c
index e4c9d0ba25a2,14c9781ec0ce..000000000000
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@@ -4579,12 -4716,11 +4610,18 @@@ xfs_bmapi_convert_delalloc
if (error)
goto out_finish;

++<<<<<<< HEAD
+ error = -ENOSPC;
+ if (WARN_ON_ONCE(bma.blkno == NULLFSBLOCK))
+ goto out_finish;
+ error = -EFSCORRUPTED;
+ if (WARN_ON_ONCE(!xfs_valid_startblock(ip, bma.got.br_startblock)))
++=======
+ if (WARN_ON_ONCE(!xfs_valid_startblock(ip, bma.got.br_startblock))) {
+ xfs_bmap_mark_sick(ip, whichfork);
+ error = -EFSCORRUPTED;
++>>>>>>> 6773da870ab8 (xfs: fix error returns from xfs_bmapi_write)
goto out_finish;
- }

XFS_STATS_ADD(mp, xs_xstrat_bytes, XFS_FSB_TO_B(mp, bma.length));
XFS_STATS_INC(mp, xs_xstrat_quick);
diff --cc fs/xfs/xfs_iomap.c
index 30306bbdd059,f5d0ed45721b..000000000000
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@@ -300,16 -322,10 +300,21 @@@ xfs_iomap_write_direct
if (error)
goto out_unlock;

++<<<<<<< HEAD
+ /*
+ * Copy any maps to caller's array and return any error.
+ */
+ if (nimaps == 0) {
+ error = -ENOSPC;
+ goto out_unlock;
+ }
+
+ if (unlikely(!xfs_valid_startblock(ip, imap->br_startblock)))
++=======
+ if (unlikely(!xfs_valid_startblock(ip, imap->br_startblock))) {
+ xfs_bmap_mark_sick(ip, XFS_DATA_FORK);
++>>>>>>> 6773da870ab8 (xfs: fix error returns from xfs_bmapi_write)
error = xfs_alert_fsblock_zero(ip, imap);
- }

out_unlock:
*seq = xfs_iomap_inode_sequence(ip, 0);
* Unmerged path fs/xfs/scrub/quota_repair.c
* Unmerged path fs/xfs/scrub/rtbitmap_repair.c
diff --git a/fs/xfs/libxfs/xfs_attr_remote.c b/fs/xfs/libxfs/xfs_attr_remote.c
index 0c8bee3abc3b..d21ed06642f9 100644
--- a/fs/xfs/libxfs/xfs_attr_remote.c
+++ b/fs/xfs/libxfs/xfs_attr_remote.c
@@ -613,7 +613,6 @@ xfs_attr_rmtval_set_blk(
if (error)
return error;

- ASSERT(nmap == 1);
ASSERT((map->br_startblock != DELAYSTARTBLOCK) &&
(map->br_startblock != HOLESTARTBLOCK));

* Unmerged path fs/xfs/libxfs/xfs_bmap.c
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 747ec77912c3..906a60e9355e 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -2146,8 +2146,8 @@ xfs_da_grow_inode_int(
struct xfs_inode *dp = args->dp;
int w = args->whichfork;
xfs_rfsblock_t nblks = dp->i_nblocks;
- struct xfs_bmbt_irec map, *mapp;
- int nmap, error, got, i, mapi;
+ struct xfs_bmbt_irec map, *mapp = &map;
+ int nmap, error, got, i, mapi = 1;

/*
* Find a spot in the file space to put the new block.
@@ -2163,14 +2163,7 @@ xfs_da_grow_inode_int(
error = xfs_bmapi_write(tp, dp, *bno, count,
xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA|XFS_BMAPI_CONTIG,
args->total, &map, &nmap);
- if (error)
- return error;
-
- ASSERT(nmap <= 1);
- if (nmap == 1) {
- mapp = &map;
- mapi = 1;
- } else if (nmap == 0 && count > 1) {
+ if (error == -ENOSPC && count > 1) {
xfs_fileoff_t b;
int c;

@@ -2187,16 +2180,13 @@ xfs_da_grow_inode_int(
args->total, &mapp[mapi], &nmap);
if (error)
goto out_free_map;
- if (nmap < 1)
- break;
mapi += nmap;
b = mapp[mapi - 1].br_startoff +
mapp[mapi - 1].br_blockcount;
}
- } else {
- mapi = 0;
- mapp = NULL;
}
+ if (error)
+ goto out_free_map;

/*
* Count the blocks we got, make sure it matches the total.
* Unmerged path fs/xfs/scrub/quota_repair.c
* Unmerged path fs/xfs/scrub/rtbitmap_repair.c
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c
index a6e40c35e9f1..afcbcf308c46 100644
--- a/fs/xfs/xfs_bmap_util.c
+++ b/fs/xfs/xfs_bmap_util.c
@@ -861,33 +861,32 @@ xfs_alloc_file_space(
if (error)
goto error;

- error = xfs_bmapi_write(tp, ip, startoffset_fsb,
- allocatesize_fsb, XFS_BMAPI_PREALLOC, 0, imapp,
- &nimaps);
- if (error)
- goto error;
-
- ip->i_diflags |= XFS_DIFLAG_PREALLOC;
- xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
-
- error = xfs_trans_commit(tp);
- xfs_iunlock(ip, XFS_ILOCK_EXCL);
- if (error)
- break;
-
/*
* If the allocator cannot find a single free extent large
* enough to cover the start block of the requested range,
- * xfs_bmapi_write will return 0 but leave *nimaps set to 0.
+ * xfs_bmapi_write will return -ENOSR.
*
* In that case we simply need to keep looping with the same
* startoffset_fsb so that one of the following allocations
* will eventually reach the requested range.
*/
- if (nimaps) {
+ error = xfs_bmapi_write(tp, ip, startoffset_fsb,
+ allocatesize_fsb, XFS_BMAPI_PREALLOC, 0, imapp,
+ &nimaps);
+ if (error) {
+ if (error != -ENOSR)
+ goto error;
+ error = 0;
+ } else {
startoffset_fsb += imapp->br_blockcount;
allocatesize_fsb -= imapp->br_blockcount;
}
+
+ ip->i_diflags |= XFS_DIFLAG_PREALLOC;
+ xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE);
+
+ error = xfs_trans_commit(tp);
+ xfs_iunlock(ip, XFS_ILOCK_EXCL);
}

return error;
diff --git a/fs/xfs/xfs_dquot.c b/fs/xfs/xfs_dquot.c
index dd541eaca818..2ec2e903dc0b 100644
--- a/fs/xfs/xfs_dquot.c
+++ b/fs/xfs/xfs_dquot.c
@@ -328,7 +328,6 @@ xfs_dquot_disk_alloc(
if (error)
return error;
ASSERT(map.br_blockcount == XFS_DQUOT_CLUSTER_SIZE_FSB);
- ASSERT(nmaps == 1);
ASSERT((map.br_startblock != DELAYSTARTBLOCK) &&
(map.br_startblock != HOLESTARTBLOCK));

* Unmerged path fs/xfs/xfs_iomap.c
diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c
index ae0964ec5909..c782b20af3f1 100644
--- a/fs/xfs/xfs_reflink.c
+++ b/fs/xfs/xfs_reflink.c
@@ -428,13 +428,6 @@ xfs_reflink_fill_cow_hole(
if (error)
return error;

- /*
- * Allocation succeeded but the requested range was not even partially
- * satisfied? Bail out!
- */
- if (nimaps == 0)
- return -ENOSPC;
-
convert:
return xfs_reflink_convert_unwritten(ip, imap, cmap, convert_now);

@@ -497,13 +490,6 @@ xfs_reflink_fill_delalloc(
error = xfs_trans_commit(tp);
if (error)
return error;
-
- /*
- * Allocation succeeded but the requested range was not even
- * partially satisfied? Bail out!
- */
- if (nimaps == 0)
- return -ENOSPC;
} while (cmap->br_startoff + cmap->br_blockcount <= imap->br_startoff);

return xfs_reflink_convert_unwritten(ip, imap, cmap, convert_now);
diff --git a/fs/xfs/xfs_rtalloc.c b/fs/xfs/xfs_rtalloc.c
index 699066fb9052..32ee98725f54 100644
--- a/fs/xfs/xfs_rtalloc.c
+++ b/fs/xfs/xfs_rtalloc.c
@@ -815,8 +815,6 @@ xfs_growfs_rt_alloc(
nmap = 1;
error = xfs_bmapi_write(tp, ip, oblocks, nblocks - oblocks,
XFS_BMAPI_METADATA, 0, &map, &nmap);
- if (!error && nmap < 1)
- error = -ENOSPC;
if (error)
goto out_trans_cancel;
/*
Loading