Darrick J. Wong
b82a5c42a5
xfs: don't unconditionally null args->pag in xfs_bmap_btalloc_at_eof
...
xfs/170 on a filesystem with su=128k,sw=4 produces this splat:
BUG: kernel NULL pointer dereference, address: 0000000000000010
#PF: supervisor write access in kernel mode
#PF: error_code(0x0002) - not-present page
PGD 0 P4D 0
Oops: 0002 [#1 ] PREEMPT SMP
CPU: 1 PID: 4022907 Comm: dd Tainted: G W 6.3.0-xfsx #2 6ebeeffbe9577d32
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20171121_152543-x86-ol7-bu
RIP: 0010:xfs_perag_rele+0x10/0x70 [xfs]
RSP: 0018:ffffc90001e43858 EFLAGS: 00010217
RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000100
RDX: ffffffffa054e717 RSI: 0000000000000005 RDI: 0000000000000000
RBP: ffff888194eea000 R08: 0000000000000000 R09: 0000000000000037
R10: ffff888100ac1cb0 R11: 0000000000000018 R12: 0000000000000000
R13: ffffc90001e43a38 R14: ffff888194eea000 R15: ffff888194eea000
FS: 00007f93d1a0e740(0000) GS:ffff88843fc80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000010 CR3: 000000018a34f000 CR4: 00000000003506e0
Call Trace:
<TASK>
xfs_bmap_btalloc+0x1a7/0x5d0 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
xfs_bmapi_allocate+0xee/0x470 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
xfs_bmapi_write+0x539/0x9e0 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
xfs_iomap_write_direct+0x1bb/0x2b0 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
xfs_direct_write_iomap_begin+0x51c/0x710 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
iomap_iter+0x132/0x2f0
__iomap_dio_rw+0x2f8/0x840
iomap_dio_rw+0xe/0x30
xfs_file_dio_write_aligned+0xad/0x180 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
xfs_file_write_iter+0xfb/0x190 [xfs f85291d6841cbb3dc740083f1f331c0327394518]
vfs_write+0x2eb/0x410
ksys_write+0x65/0xe0
do_syscall_64+0x2b/0x80
This crash occurs under the "out_low_space" label. We grabbed a perag
reference, passed it via args->pag into xfs_bmap_btalloc_at_eof, and
afterwards args->pag is NULL. Fix the second function not to clobber
args->pag if the caller had passed one in.
Fixes: 85843327094f ("xfs: factor xfs_bmap_btalloc()")
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
2023-05-02 09:14:27 +10:00
..
2023-05-02 09:14:27 +10:00
2023-04-20 08:18:34 +10:00
2023-04-11 19:05:19 -07:00
2022-01-15 16:30:29 +02:00
2021-10-22 16:00:31 -07:00
2023-04-11 19:00:38 -07:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:27 +01:00
2023-03-05 15:13:23 -08:00
2022-07-20 16:40:39 -07:00
2022-10-31 08:58:20 -07:00
2022-05-23 08:43:46 +10:00
2022-07-09 15:17:21 -07:00
2022-07-14 12:14:33 -06:00
2023-04-11 18:59:58 -07:00
2021-10-22 16:04:20 -07:00
2023-04-12 15:49:44 +10:00
2022-11-29 09:09:17 +11:00
2023-04-12 15:49:23 +10:00
2022-11-30 09:25:46 -08:00
2022-04-21 10:46:40 +10:00
2022-11-30 08:55:18 -08:00
2022-07-20 16:40:39 -07:00
2023-04-11 19:05:05 -07:00
2023-03-19 09:55:49 -07:00
2022-10-04 16:39:58 +11:00
2023-02-13 09:14:54 +11:00
2021-08-19 10:07:12 -07:00
2021-08-06 11:05:36 -07:00
2021-08-06 11:05:36 -07:00
2023-04-12 15:48:59 +10:00
2022-05-11 17:12:09 +10:00
2023-04-11 18:59:59 -07:00
2023-04-11 18:59:59 -07:00
2023-02-10 08:59:48 -08:00
2023-02-09 18:36:17 -08:00
2021-08-19 10:07:13 -07:00
2023-01-05 07:34:21 -08:00
2021-06-02 10:48:24 +10:00
2023-04-11 18:59:58 -07:00
2022-10-31 08:58:20 -07:00
2023-02-23 17:09:35 -08:00
2023-02-13 09:14:56 +11:00
2023-02-13 09:14:56 +11:00
2023-02-14 17:51:35 -08:00
2022-08-05 16:32:45 -07:00
2023-02-09 18:36:17 -08:00
2021-08-19 10:07:13 -07:00
2023-04-11 19:00:21 -07:00
2023-04-11 19:00:21 -07:00
2022-05-04 11:45:11 +10:00
2021-10-22 16:04:20 -07:00
2022-09-19 06:47:14 +10:00
2022-09-19 06:45:14 +10:00
2022-03-29 18:21:59 -07:00
2023-02-28 16:08:30 -08:00
2023-01-19 09:24:28 +01:00
2023-01-19 09:24:29 +01:00
2022-01-18 10:18:36 -08:00
2023-02-20 11:53:11 -08:00
2023-01-19 09:24:27 +01:00
2023-03-24 08:40:01 -07:00
2022-11-29 09:09:17 +11:00
2023-01-19 09:24:30 +01:00
2023-01-19 09:24:02 +01:00
2023-01-19 09:24:29 +01:00
2023-01-19 09:24:29 +01:00
2023-04-11 18:59:55 -07:00
2022-07-14 11:47:42 +10:00
2023-04-11 18:59:55 -07:00
2022-04-13 07:02:44 +00:00
2023-04-11 18:59:58 -07:00
2022-07-07 18:56:09 +10:00
2022-07-07 18:56:09 +10:00
2022-10-18 14:39:29 -07:00
2022-11-30 09:25:46 -08:00
2022-07-07 18:56:08 +10:00
2022-04-21 16:45:03 +10:00
2022-05-27 10:31:34 +10:00
2022-11-16 19:20:20 -08:00
2023-02-13 09:14:52 +11:00
2021-10-22 16:04:20 -07:00
2022-10-10 20:32:10 -07:00
2022-10-31 08:58:20 -07:00
2023-01-19 09:24:02 +01:00
2021-08-19 10:07:12 -07:00
2022-06-23 13:34:38 -07:00
2023-03-05 15:13:22 -08:00
2022-05-11 17:12:09 +10:00
2021-08-09 10:52:18 -07:00
2022-05-11 17:12:09 +10:00
2023-04-11 18:59:58 -07:00
2021-10-22 16:04:20 -07:00
2023-02-13 09:14:42 +11:00
2022-07-07 19:07:40 +10:00
2023-04-11 18:59:58 -07:00
2021-10-22 16:04:20 -07:00
2022-11-16 15:25:03 -08:00
2022-04-12 06:49:42 +10:00
2022-09-19 06:48:14 +10:00
2023-04-11 19:05:19 -07:00
2022-07-17 17:14:30 -07:00
2023-01-19 09:24:30 +01:00
2023-01-19 09:24:28 +01:00
2022-05-11 17:01:22 +10:00
2023-02-10 08:59:48 -08:00
2023-02-10 08:59:48 -08:00
2022-11-28 17:24:35 -08:00
2023-04-11 18:59:58 -07:00
2022-11-30 08:55:18 -08:00
2021-08-19 10:07:14 -07:00
2022-05-11 17:12:09 +10:00
2022-07-07 18:55:59 +10:00
2023-02-11 04:12:06 +11:00
2023-02-11 04:11:06 +11:00
2023-02-10 09:06:06 -08:00
2022-05-27 10:34:04 +10:00