Skip to content

Commit 054fd15

Browse files
Chen Nirichardweinberger
authored andcommitted
ubifs: add check for crypto_shash_tfm_digest
Add check for the return value of crypto_shash_tfm_digest() and return the error if it fails in order to catch the error. Fixes: 817aa09 ("ubifs: support offline signed images") Signed-off-by: Chen Ni <nichen@iscas.ac.cn> Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent 25e79a7 commit 054fd15

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/ubifs/master.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,13 @@ static int mst_node_check_hash(const struct ubifs_info *c,
6767
{
6868
u8 calc[UBIFS_MAX_HASH_LEN];
6969
const void *node = mst;
70+
int ret;
7071

71-
crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
72+
ret = crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
7273
UBIFS_MST_NODE_SZ - sizeof(struct ubifs_ch),
7374
calc);
75+
if (ret)
76+
return ret;
7477

7578
if (ubifs_check_hash(c, expected, calc))
7679
return -EPERM;

0 commit comments

Comments
 (0)