* [PATCH v2] ubifs: add check for crypto_shash_tfm_digest
@ 2024-06-20 8:19 Chen Ni
2024-06-20 8:29 ` Zhihao Cheng
0 siblings, 1 reply; 2+ messages in thread
From: Chen Ni @ 2024-06-20 8:19 UTC (permalink / raw)
To: richard, chengzhihao1, s.hauer; +Cc: linux-mtd, linux-kernel, Chen Ni
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>
---
Changelog:
v1 -> v2:
1. Update fix tag.
---
fs/ubifs/master.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
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;
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] ubifs: add check for crypto_shash_tfm_digest
2024-06-20 8:19 [PATCH v2] ubifs: add check for crypto_shash_tfm_digest Chen Ni
@ 2024-06-20 8:29 ` Zhihao Cheng
0 siblings, 0 replies; 2+ messages in thread
From: Zhihao Cheng @ 2024-06-20 8:29 UTC (permalink / raw)
To: Chen Ni, richard, s.hauer; +Cc: linux-mtd, linux-kernel
在 2024/6/20 16:19, Chen Ni 写道:
> 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>
> ---
> Changelog:
>
> v1 -> v2:
>
> 1. Update fix tag.
> ---
> fs/ubifs/master.c | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
Reviewed-by: Zhihao Cheng <chengzhihao1@huawei.com>
>
> 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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-06-20 8:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-20 8:19 [PATCH v2] ubifs: add check for crypto_shash_tfm_digest Chen Ni
2024-06-20 8:29 ` Zhihao Cheng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®