summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChen Ni <nichen@iscas.ac.cn>2024-06-20 10:19:26 +0200
committerRichard Weinberger <richard@nod.at>2024-07-12 22:01:09 +0200
commit054fd15984454f031611d6c63675fc578aad0cb1 (patch)
tree5f53f1ccc86dad726bf69b0a463bbde9cf6a7dd5 /fs
parentubifs: Fix inconsistent inode size when powercut happens during appendant wri... (diff)
downloadlinux-054fd15984454f031611d6c63675fc578aad0cb1.tar.xz
linux-054fd15984454f031611d6c63675fc578aad0cb1.zip
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: 817aa094842d ("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>
Diffstat (limited to 'fs')
-rw-r--r--fs/ubifs/master.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index 7adc37c10b6a..a148760fa49e 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -67,10 +67,13 @@ static int mst_node_check_hash(const struct ubifs_info *c,
{
u8 calc[UBIFS_MAX_HASH_LEN];
const void *node = mst;
+ int ret;
- crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
+ ret = crypto_shash_tfm_digest(c->hash_tfm, node + sizeof(struct ubifs_ch),
UBIFS_MST_NODE_SZ - sizeof(struct ubifs_ch),
calc);
+ if (ret)
+ return ret;
if (ubifs_check_hash(c, expected, calc))
return -EPERM;