Files
linux/drivers/md
Mikulas Patocka d147e63cd7 dm table: fix invalid memory accesses with too high sector number
commit 1cfd5d3399 upstream.

If the sector number is too high, dm_table_find_target() should return a
pointer to a zeroed dm_target structure (the caller should test it with
dm_target_is_valid).

However, for some table sizes, the code in dm_table_find_target() that
performs btree lookup will access out of bound memory structures.

Fix this bug by testing the sector number at the beginning of
dm_table_find_target(). Also, add an "inline" keyword to the function
dm_table_get_size() because this is a hot path.

Fixes: 512875bd96 ("dm: table detect io beyond device")
Cc: stable@vger.kernel.org
Reported-by: Zhang Tao <kontais@zoho.com>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-15 14:21:16 +09:00
..
2014-01-14 23:23:03 -05:00
2017-01-31 13:55:27 -08:00
2017-01-31 10:45:54 -08:00
2016-06-07 13:41:38 -06:00
2016-08-07 14:41:02 -06:00
2007-10-20 02:01:26 +01:00
2017-04-12 12:57:51 +02:00
2016-08-07 14:41:02 -06:00
2016-01-20 13:52:20 -08:00
2017-10-21 17:21:35 +02:00
2023-05-15 13:58:18 +09:00
2016-09-21 09:09:44 -07:00
2016-08-07 14:41:02 -06:00
2016-08-07 14:41:02 -06:00
2015-08-13 12:31:57 -06:00