Wenwen Wang e7bf90e5af block/bio-integrity: fix a memory leak bug
In bio_integrity_prep(), a kernel buffer is allocated through kmalloc() to
hold integrity metadata. Later on, the buffer will be attached to the bio
structure through bio_integrity_add_page(), which returns the number of
bytes of integrity metadata attached. Due to unexpected situations,
bio_integrity_add_page() may return 0. As a result, bio_integrity_prep()
needs to be terminated with 'false' returned to indicate this error.
However, the allocated kernel buffer is not freed on this execution path,
leading to a memory leak.

To fix this issue, free the allocated buffer before returning from
bio_integrity_prep().

Reviewed-by: Ming Lei <ming.lei@redhat.com>
Acked-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2019-07-11 20:01:21 -06:00
..
2019-07-09 10:45:06 -07:00
2019-07-01 08:18:54 -06:00
2019-07-10 09:00:57 -06:00
2019-05-07 18:14:36 -07:00
2019-07-09 10:45:06 -07:00
2019-07-02 21:03:27 -06:00
2019-05-07 18:14:36 -07:00
2019-07-02 21:03:27 -06:00
2019-06-20 10:29:22 -06:00
2019-06-15 01:46:09 -06:00
2018-11-07 13:42:32 -07:00