diff options
| author | Ma Xinmeng <1564938642@qq.com> | 2026-09-25 11:05:39 +0800 |
|---|---|---|
| committer | Mikulas Patocka <mpatocka@redhat.com> | 2026-09-30 14:16:56 +0200 |
| commit | fcbde6227fcc53c73f08c56b2539e462d545cac6 (patch) | |
| tree | 49502d8453fdd33abcb5fd07a655ecaf4dd510e8 /include/linux | |
| parent | c9417c1c5269e2bd0570fbe53e4ec03a8d31f008 (diff) | |
| download | linux-next-fcbde6227fcc53c73f08c56b2539e462d545cac6.tar.gz linux-next-fcbde6227fcc53c73f08c56b2539e462d545cac6.zip | |
dm-snap: reject the transient exception store for snapshot-merge
snapshot_merge_next_chunks() calls s->store->type->prepare_merge() without
checking it. The transient store ("N") implements neither prepare_merge nor
commit_merge, and snapshot_ctr() validates those callbacks only on the handover
path (__validate_exception_handover()), so a directly constructed snapshot-merge
calls a NULL prepare_merge on resume:
snapshot_merge_resume -> snapshot_merge_next_chunks -> prepare_merge(...)
commit_merge() is NULL for the same reason. Userspace only issues documented
device-mapper ioctls (CAP_SYS_ADMIN); this is a misconfiguration the kernel must
reject rather than oops on.
Reject the combination in snapshot_ctr() at table-load time (-EINVAL), the same
check the handover path already performs; this also covers the commit_merge()
call site, which a guard local to the prepare_merge call would miss.
Tested on Linux v6.6.157 KASAN: unpatched, the dmsetup reproducer oopses in
snapshot_merge_next_chunks(); with this patch, the table load fails with -EINVAL
and no oops. Also present on v6.6.145; still present on the linux-dm tree
(555f3d7be91a) and on torvalds/linux master (62f4c998b297) as of 2026-09-22.
Note that this is not a security bug because only root can trigger it.
Signed-off-by: Ma Xinmeng <1564938642@qq.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Cc: stable@vger.kernel.org
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
