Mikulas Patocka d4a3806bea dm integrity: fix double free on memory allocation failure
If the statement "recalc_tags = kvmalloc(recalc_tags_size, GFP_NOIO);"
fails, we call "vfree(recalc_buffer)" and we jump to the label "oom".

If the condition "recalc_sectors >= 1U << ic->sb->log2_sectors_per_block"
is false, we jump to the label "free_ret" and call "vfree(recalc_buffer)"
again, on an already released memory block.

Fix the bug by setting "recalc_buffer = NULL" after freeing it.

Fixes: da8b4fc1f63a ("dm integrity: only allocate recalculate buffer when needed")
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
2023-07-25 11:55:50 -04:00
..
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:07 -05:00
2023-02-14 14:23:06 -05:00
2022-08-02 14:38:59 -07:00
2023-06-13 15:25:39 -07:00
2023-06-13 15:25:39 -07:00
2023-06-23 09:41:47 -07:00
2023-06-23 09:41:47 -07:00
2023-06-13 15:25:39 -07:00
2023-06-13 15:25:39 -07:00
2023-06-27 21:24:18 -07:00
2023-06-27 21:24:18 -07:00
2023-06-13 15:25:39 -07:00