Mikulas Patocka
1ff004c41c
dm snapshot: fix crash with transient storage and zero chunk size
...
commit c699a0db2d upstream.
The following commands will crash the kernel:
modprobe brd rd_size=1048576
dmsetup create o --table "0 `blockdev --getsize /dev/ram0` snapshot-origin /dev/ram0"
dmsetup create s --table "0 `blockdev --getsize /dev/ram0` snapshot /dev/ram0 /dev/ram1 N 0"
The reason is that when we test for zero chunk size, we jump to the label
bad_read_metadata without setting the "r" variable. The function
snapshot_ctr destroys all the structures and then exits with "r == 0". The
kernel then crashes because it falsely believes that snapshot_ctr
succeeded.
In order to fix the bug, we set the variable "r" to -EINVAL.
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com >
Cc: stable@vger.kernel.org
Signed-off-by: Mike Snitzer <snitzer@redhat.com >
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org >
2021-05-26 11:48:33 +02:00
..
2020-10-01 13:14:27 +02:00
2021-05-22 10:59:22 +02:00
2018-06-08 11:53:14 -04:00
2017-06-09 09:27:32 -06:00
2018-06-08 11:53:14 -04:00
2017-03-07 11:30:16 -05:00
2020-03-25 08:06:07 +01:00
2021-03-11 14:04:59 +01:00
2017-11-02 11:10:55 +01:00
2018-04-30 15:40:40 -04:00
2017-03-07 13:28:31 -05:00
2016-12-16 00:13:41 +02:00
2020-09-09 19:04:31 +02:00
2017-03-07 13:28:31 -05:00
2017-03-07 13:28:31 -05:00
2018-06-12 16:19:22 -07:00
2014-01-16 13:44:11 -05:00
2017-03-07 13:28:31 -05:00
2020-03-11 14:15:05 +01:00
2021-03-04 09:39:57 +01:00
2021-03-04 09:39:57 +01:00
2019-05-25 18:23:39 +02:00
2021-03-04 09:39:59 +01:00
2015-11-04 21:19:53 -08:00
2016-01-08 20:03:05 -05:00
2019-12-05 09:20:36 +01:00
2021-01-30 13:32:13 +01:00
2018-06-05 08:47:43 -06:00
2021-03-30 14:36:59 +02:00
2019-08-29 08:28:55 +02:00
2019-01-26 09:32:42 +01:00
2018-05-30 15:33:32 -06:00
2015-04-15 12:10:20 -04:00
2019-07-03 13:14:45 +02:00
2016-11-01 09:43:26 -06:00
2020-06-25 15:32:49 +02:00
2016-02-22 22:34:42 -05:00
2018-01-29 13:44:58 -05:00
2019-01-26 09:32:42 +01:00
2021-05-22 10:59:21 +02:00
2018-06-12 18:28:00 -07:00
2017-02-17 00:54:09 -05:00
2021-05-22 10:59:23 +02:00
2017-08-28 10:23:28 -04:00
2018-01-29 13:44:58 -05:00
2020-01-23 08:21:29 +01:00
2016-01-08 20:03:05 -05:00
2021-05-26 11:48:33 +02:00
2018-06-12 16:19:22 -07:00
2017-11-02 11:10:55 +01:00
2018-05-22 23:18:31 -07:00
2018-06-12 16:19:22 -07:00
2016-06-10 15:15:44 -04:00
2021-03-11 14:05:01 +01:00
2019-09-16 08:22:12 +02:00
2020-09-09 19:04:31 +02:00
2019-01-31 08:14:38 +01:00
2019-04-05 22:32:59 +02:00
2019-01-26 09:32:42 +01:00
2021-04-28 13:16:50 +02:00
2021-04-28 13:16:50 +02:00
2021-03-30 14:37:02 +02:00
2018-04-03 15:04:29 -04:00
2020-12-11 13:25:04 +01:00
2017-06-09 09:27:32 -06:00
2020-06-25 15:32:58 +02:00
2020-06-25 15:32:58 +02:00
2020-07-09 09:37:12 +02:00
2019-12-17 20:34:53 +01:00
2021-03-04 09:39:57 +01:00
2018-01-17 09:16:06 -05:00
2018-06-08 11:59:51 -04:00
2018-06-08 11:59:51 -04:00
2021-05-22 10:59:24 +02:00
2018-08-01 15:49:39 -07:00
2020-12-30 11:26:16 +01:00
2017-11-02 11:10:55 +01:00
2018-05-30 15:33:32 -06:00
2019-12-17 20:34:55 +01:00
2017-11-14 16:07:26 -08:00
2019-12-17 20:34:55 +01:00
2018-05-30 15:33:32 -06:00
2021-05-22 10:59:25 +02:00
2019-12-17 20:34:55 +01:00
2020-06-25 15:33:10 +02:00
2019-10-05 13:10:12 +02:00
2017-11-02 11:10:55 +01:00
2021-05-22 10:59:20 +02:00
2018-05-30 15:33:32 -06:00
2019-02-06 17:30:16 +01:00
2018-08-31 17:38:09 -07:00
2018-05-30 15:33:32 -06:00
2020-11-05 11:08:45 +01:00
2018-06-09 12:01:36 -07:00
2021-01-06 14:44:58 +01:00
2018-05-30 15:33:32 -06:00