dm thin metadata: Fix use-after-free in dm_bm_set_read_only
Ye Bin authored
commit 3a653b20 upstream.

The following error ocurred when testing disk online/offline:

[  301.798344] device-mapper: thin: 253:5: aborting current metadata transaction
[  301.848441] device-mapper: thin: 253:5: failed to abort metadata transaction
[  301.849206] Aborting journal on device dm-26-8.
[  301.850489] EXT4-fs error (device dm-26) in __ext4_new_inode:943: Journal has aborted
[  301.851095] EXT4-fs (dm-26): Delayed block allocation failed for inode 398742 at logical offset 181 with max blocks 19 with error 30
[  301.854476] BUG: KASAN: use-after-free in dm_bm_set_read_only+0x3a/0x40 [dm_persistent_data]

Reason is:

 metadata_operation_failed
    abort_transaction
        dm_pool_abort_metadata
	    __create_persistent_data_objects
	        r = __open_or_format_metadata
	        if (r) --> If failed will free pmd->bm but pmd->bm not set NULL
		    dm_block_manager_destroy(pmd->bm);
    set_pool_mode
	dm...
4469ea59
Name Last commit Last update
Documentation affs: fix basic permission bits to actually work
LICENSES LICENSES: Rename other to deprecated
arch mips/oprofile: Fix fallthrough placement
block blk-stat: make q->stats->lock irqsafe
certs .gitignore: add SPDX License Identifier
crypto crypto: af_alg - Work around empty control messages without MSG_MORE
drivers dm thin metadata: Fix use-after-free in dm_bm_set_read_only
fs io_uring: fix removing the wrong file in __io_sqe_files_update()
include drm/i915: Fix sha_text population code
init bootconfig: Fix to find the initargs correctly
ipc mmap locking API: use coccinelle to convert mmap_sem rwsem call sites
kernel bpf: Fix a buffer out-of-bound access when filling raw_tp link_info
lib test_kmod: avoid potential double free in trigger_config_run_type()
mm mm: fix pin vs. gup mismatch with gate pages
net Bluetooth: Return NOTIFY_DONE for hci_suspend_notifier
samples samples: bpf: Fix bpf programs with kprobe/sys_connect event
scripts kconfig: qconf: remove qInfo() to get back Qt4 support
security ima: Fail rule parsing when appraise_flag=blacklist is unsupportable
sound ALSA: hda/realtek - Improved routing for Thinkpad X1 7th/8th Gen
tools perf bench: The do_run_multi_threaded() function must use IS_ERR(perf_session__new())
usr bpfilter: match bit size of bpfilter_umh to that of the kernel
virt KVM: Pass MMU notifier range flags to kvm_unmap_hva_range()
.clang-format block: add bio_for_each_bvec_all()
.cocciconfig scripts: add Linux .cocciconfig for coccinelle
.get_maintainer.ignore Opt out of scripts/get_maintainer.pl
.gitattributes .gitattributes: use 'dts' diff driver for dts files
.gitignore .gitignore: Do not track `defconfig` from `make savedefconfig`
.mailmap mailmap: add entry for Mike Rapoport
COPYING COPYING: state that all contributions really are covered by this file
CREDITS mailmap: change email for Ricardo Ribalda
Kbuild kbuild: rename hostprogs-y/always to hostprogs/always-y
Kconfig kbuild: ensure full rebuild when the compiler is updated
MAINTAINERS Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Makefile Linux 5.8.7
README Drop all 00-INDEX files from Documentation/
Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.