From 812df05892d39ba2487d5de15bf66878be4590ae Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 28 Feb 2022 21:49:53 -0700 Subject: [PATCH] LU-15598 tgt: free allocated page on error Free allocated page if cfs_crypto_hash_init() fails. Fixes: b1e7be00cb6e ("LU-10472 osc: add T10PI support for RPC checksum") Signed-off-by: Andreas Dilger Change-Id: I0a45a82a57a98ad2517ccf50a2be1e8d65550bb5 Reviewed-on: https://review.whamcloud.com/46659 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Li Dongyang --- lustre/target/tgt_handler.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lustre/target/tgt_handler.c b/lustre/target/tgt_handler.c index c42c74b..c763e0a 100644 --- a/lustre/target/tgt_handler.c +++ b/lustre/target/tgt_handler.c @@ -2046,9 +2046,10 @@ static int tgt_checksum_niobuf_t10pi(struct lu_target *tgt, req = cfs_crypto_hash_init(cfs_alg, NULL, 0); if (IS_ERR(req)) { - CERROR("%s: unable to initialize checksum hash %s\n", - tgt_name(tgt), cfs_crypto_hash_name(cfs_alg)); - return PTR_ERR(req); + rc = PTR_ERR(req); + CERROR("%s: unable to initialize checksum hash %s: rc = %d\n", + tgt_name(tgt), cfs_crypto_hash_name(cfs_alg), rc); + goto out; } buffer = kmap(__page); -- 1.8.3.1