diff options
author | Kota Tsuyuzaki <tsuyuzaki.kota@lab.ntt.co.jp> | 2016-11-03 19:49:49 -0700 |
---|---|---|
committer | Clay Gerrard <clay.gerrard@gmail.com> | 2016-11-09 23:28:55 +0000 |
commit | 74eaa374c107d1a9e140fc7a8c1bf91386619940 (patch) | |
tree | 14aa116eb85e3cb1fa3db7e77fd1974385432b5e /src | |
parent | b96cf4b2cc98dbdcdf60c80cd4a353f5c11959c8 (diff) | |
download | liberasurecode-74eaa374c107d1a9e140fc7a8c1bf91386619940.tar.gz |
Fix error handling on gf_ivnert_matrix in isa-l backend
Current isa-l has possibility to return corrupted decoded data or
corrupted reconstructed data on decode/reconstruct without error code.
That is from the specification of isa-l rs vandermond matrix discussed
at [1]. With many # of parities cases, we may hit the case above due to
failing to get the inverse matrix from the encode matrix.
The isa-l maintener gbtucker suggests a good way to detect the failing
inverse matrix, that we should handle the return value gf_invert_matrix.
If gf_invert_matrix returns not 0, we should stop to decode/reconstruct
and return failure return code to the caller immediately. Otherwise, the
caller regards the garbage data/fragment as correct one.
And this patch adds the specific test case we can hit the issue (it
happens not so general).
1: https://github.com/01org/isa-l/issues/10
Related-Change: I6eb150d9d0c3febf233570fa7729f9f72df2e9be
Change-Id: Icee788a0931fe692fe0de31fabc4ba450e338a87
Diffstat (limited to 'src')
-rw-r--r-- | src/backends/isa-l/isa_l_rs_vand.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backends/isa-l/isa_l_rs_vand.c b/src/backends/isa-l/isa_l_rs_vand.c index d2f740f..ebce441 100644 --- a/src/backends/isa-l/isa_l_rs_vand.c +++ b/src/backends/isa-l/isa_l_rs_vand.c @@ -261,7 +261,10 @@ static int isa_l_rs_vand_decode(void *desc, char **data, char **parity, goto out; } - isa_l_desc->gf_invert_matrix(decode_matrix, decode_inverse, k); + int im_ret = isa_l_desc->gf_invert_matrix(decode_matrix, decode_inverse, k); + if (im_ret < 0) { + goto out; + } // Generate g_tbls from computed decode matrix (k x k) matrix g_tbls = malloc(sizeof(unsigned char) * (k * m * 32)); @@ -365,7 +368,10 @@ static int isa_l_rs_vand_reconstruct(void *desc, char **data, char **parity, goto out; } - isa_l_desc->gf_invert_matrix(decode_matrix, decode_inverse, k); + int im_ret = isa_l_desc->gf_invert_matrix(decode_matrix, decode_inverse, k); + if (im_ret < 0) { + goto out; + } /** * Get the row needed to reconstruct |