Skip to content

Commit b1d65f7

Browse files
Wei Yongjunmstsirkin
authored andcommitted
virtio-crypto: fix memory leak in virtio_crypto_alg_skcipher_close_session()
'vc_ctrl_req' is alloced in virtio_crypto_alg_skcipher_close_session(), and should be freed in the invalid ctrl_status->status error handling case. Otherwise there is a memory leak. Fixes: 0756ad1 ("virtio-crypto: use private buffer for control request") Signed-off-by: Wei Yongjun <[email protected]> Message-Id: <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Gonglei <[email protected]> Acked-by: zhenwei pi<[email protected]> Acked-by: Jason Wang <[email protected]>
1 parent a4722f6 commit b1d65f7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/crypto/virtio/virtio_crypto_skcipher_algs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,8 @@ static int virtio_crypto_alg_skcipher_close_session(
239239
pr_err("virtio_crypto: Close session failed status: %u, session_id: 0x%llx\n",
240240
ctrl_status->status, destroy_session->session_id);
241241

242-
return -EINVAL;
242+
err = -EINVAL;
243+
goto out;
243244
}
244245

245246
err = 0;

0 commit comments

Comments
 (0)