ubifs: Fix error return code in ubifs_init_authentication()
authorWang ShaoBo <bobo.shaobowang@huawei.com>
Tue, 24 Nov 2020 06:33:20 +0000 (14:33 +0800)
committerRichard Weinberger <richard@nod.at>
Sun, 13 Dec 2020 20:57:20 +0000 (21:57 +0100)
Fix to return PTR_ERR() error code from the error handling case where
ubifs_hash_get_desc() failed instead of 0 in ubifs_init_authentication(),
as done elsewhere in this function.

Fixes: 49525e5eecca5 ("ubifs: Add helper functions for authentication support")
Signed-off-by: Wang ShaoBo <bobo.shaobowang@huawei.com>
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
fs/ubifs/auth.c

index b93b3cd..8c50de6 100644 (file)
@@ -338,8 +338,10 @@ int ubifs_init_authentication(struct ubifs_info *c)
        c->authenticated = true;
 
        c->log_hash = ubifs_hash_get_desc(c);
-       if (IS_ERR(c->log_hash))
+       if (IS_ERR(c->log_hash)) {
+               err = PTR_ERR(c->log_hash);
                goto out_free_hmac;
+       }
 
        err = 0;