Commit 135496c
dm cache: fix flushing uninitialized delayed_work on cache_ctr error
An unexpected WARN_ON from flush_work() may occur when cache creation
fails, caused by destroying the uninitialized delayed_work waker in the
error path of cache_create(). For example, the warning appears on the
superblock checksum error.
Reproduce steps:
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0"
dmsetup create cdata --table "0 65536 linear /dev/sdc 8192"
dmsetup create corig --table "0 524288 linear /dev/sdc 262144"
dd if=/dev/urandom of=/dev/mapper/cmeta bs=4k count=1 oflag=direct
dmsetup create cache --table "0 524288 cache /dev/mapper/cmeta \
/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0"
Kernel logs:
(snip)
WARNING: CPU: 0 PID: 84 at kernel/workqueue.c:4178 __flush_work+0x5d4/0x890
Fix by pulling out the cancel_delayed_work_sync() from the constructor's
error path. This patch doesn't affect the use-after-free fix for
concurrent dm_resume and dm_destroy (commit 6a459d8 ("dm cache: Fix
UAF in destroy()")) as cache_dtr is not changed.
Signed-off-by: Ming-Hung Tsai <[email protected]>
Fixes: 6a459d8 ("dm cache: Fix UAF in destroy()")
Cc: [email protected]
Signed-off-by: Mikulas Patocka <[email protected]>
Acked-by: Joe Thornber <[email protected]>1 parent 235d2e7 commit 135496c
1 file changed
+15
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1905 | 1905 | | |
1906 | 1906 | | |
1907 | 1907 | | |
1908 | | - | |
| 1908 | + | |
1909 | 1909 | | |
1910 | | - | |
1911 | | - | |
1912 | 1910 | | |
1913 | 1911 | | |
1914 | 1912 | | |
1915 | 1913 | | |
1916 | 1914 | | |
1917 | | - | |
1918 | 1915 | | |
1919 | 1916 | | |
1920 | 1917 | | |
| |||
1942 | 1939 | | |
1943 | 1940 | | |
1944 | 1941 | | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
1945 | 1953 | | |
1946 | 1954 | | |
1947 | 1955 | | |
1948 | 1956 | | |
1949 | | - | |
1950 | | - | |
1951 | | - | |
| 1957 | + | |
1952 | 1958 | | |
1953 | 1959 | | |
1954 | 1960 | | |
| |||
2561 | 2567 | | |
2562 | 2568 | | |
2563 | 2569 | | |
2564 | | - | |
| 2570 | + | |
2565 | 2571 | | |
2566 | 2572 | | |
2567 | 2573 | | |
| |||
2612 | 2618 | | |
2613 | 2619 | | |
2614 | 2620 | | |
2615 | | - | |
| 2621 | + | |
2616 | 2622 | | |
2617 | 2623 | | |
2618 | 2624 | | |
| |||
0 commit comments