Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit ec25b90d authored by Sami Tolvanen's avatar Sami Tolvanen Committed by Alexander Grund
Browse files

UPSTREAM: dm verity fec: fix bufio leaks



Buffers read through dm_bufio_read() were not released in all code paths.

Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Cc: stable@vger.kernel.org # v4.5+
Signed-off-by: default avatarSami Tolvanen <samitolvanen@google.com>
Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
(cherry picked from commit 86e3e83b443669dd2bcc5c8a83b23e3aa0694c0d)
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
Change-Id: Id2c35ee727c6d93b37dcd47eeceb49ece086306f
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 77605091
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -147,8 +147,6 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio,
		block = fec_buffer_rs_block(v, fio, n, i);
		res = fec_decode_rs8(v, fio, block, &par[offset], neras);
		if (res < 0) {
			dm_bufio_release(buf);

			r = res;
			goto error;
		}
@@ -173,6 +171,8 @@ static int fec_decode_bufs(struct dm_verity *v, struct dm_verity_fec_io *fio,
done:
	r = corrected;
error:
	dm_bufio_release(buf);

	if (r < 0 && neras)
		DMERR_LIMIT("%s: FEC %llu: failed to correct: %d",
			    v->data_dev->name, (unsigned long long)rsb, r);
@@ -272,7 +272,7 @@ static int fec_read_bufs(struct dm_verity *v, struct dm_verity_io *io,
					  &is_zero) == 0) {
			/* skip known zero blocks entirely */
			if (is_zero)
				continue;
				goto done;

			/*
			 * skip if we have already found the theoretical