diff options
author | Mikulas Patocka <mpatocka@redhat.com> | 2019-08-23 09:54:09 -0400 |
---|---|---|
committer | Mike Snitzer <snitzer@redhat.com> | 2019-08-23 10:11:42 -0400 |
commit | 1cfd5d3399e87167b7f9157ef99daa0e959f395d (patch) | |
tree | 034851b363826a16d05f251473bf526b895f80c3 /drivers/md/dm.h | |
parent | ae148243d3f0816b37477106c05a2ec7d5f32614 (diff) | |
download | linux-1cfd5d3399e87167b7f9157ef99daa0e959f395d.tar.gz |
dm table: fix invalid memory accesses with too high sector number
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: 512875bd9661 ("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>
Diffstat (limited to 'drivers/md/dm.h')
0 files changed, 0 insertions, 0 deletions