diff options
author | Sami Tolvanen <samitolvanen@google.com> | 2017-03-31 15:32:45 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-12 06:41:12 -0400 |
commit | ab83597b9d404793d93bf80657503fac99e96299 (patch) | |
tree | 1326eb6c0149f78681497aa23edb85b6f7b7b197 /drivers/md | |
parent | 2ff087642643e9ac2aceb7a07c227357751c9a1b (diff) |
dm verity fec: fix bufio leaks
commit 86e3e83b443669dd2bcc5c8a83b23e3aa0694c0d upstream.
Buffers read through dm_bufio_read() were not released in all code paths.
Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/dm-verity-fec.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c index c3cc04d89524..78f36012eaca 100644 --- a/drivers/md/dm-verity-fec.c +++ b/drivers/md/dm-verity-fec.c | |||
@@ -146,8 +146,6 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio, | |||
146 | block = fec_buffer_rs_block(v, fio, n, i); | 146 | block = fec_buffer_rs_block(v, fio, n, i); |
147 | res = fec_decode_rs8(v, fio, block, &par[offset], neras); | 147 | res = fec_decode_rs8(v, fio, block, &par[offset], neras); |
148 | if (res < 0) { | 148 | if (res < 0) { |
149 | dm_bufio_release(buf); | ||
150 | |||
151 | r = res; | 149 | r = res; |
152 | goto error; | 150 | goto error; |
153 | } | 151 | } |
@@ -172,6 +170,8 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio, | |||
172 | done: | 170 | done: |
173 | r = corrected; | 171 | r = corrected; |
174 | error: | 172 | error: |
173 | dm_bufio_release(buf); | ||
174 | |||
175 | if (r < 0 && neras) | 175 | if (r < 0 && neras) |
176 | DMERR_LIMIT("%s: FEC %llu: failed to correct: %d", | 176 | DMERR_LIMIT("%s: FEC %llu: failed to correct: %d", |
177 | v->data_dev->name, (unsigned long long)rsb, r); | 177 | v->data_dev->name, (unsigned long long)rsb, r); |
@@ -269,7 +269,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io, | |||
269 | &is_zero) == 0) { | 269 | &is_zero) == 0) { |
270 | /* skip known zero blocks entirely */ | 270 | /* skip known zero blocks entirely */ |
271 | if (is_zero) | 271 | if (is_zero) |
272 | continue; | 272 | goto done; |
273 | 273 | ||
274 | /* | 274 | /* |
275 | * skip if we have already found the theoretical | 275 | * skip if we have already found the theoretical |