Skip to content

Commit 388bb19

Browse files
jhovoldVasily Gorbik
authored andcommitted
s390/zcrypt: fix memleak at release
If a process is interrupted while accessing the crypto device and the global ap_perms_mutex is contented, release() could return early and fail to free related resources. Fixes: 00fab23 ("s390/zcrypt: multiple zcrypt device nodes support") Cc: <[email protected]> # 4.19 Cc: Harald Freudenberger <[email protected]> Signed-off-by: Johan Hovold <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
1 parent 7d194c2 commit 388bb19

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

drivers/s390/crypto/zcrypt_api.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,7 @@ static int zcrypt_release(struct inode *inode, struct file *filp)
522522
if (filp->f_inode->i_cdev == &zcrypt_cdev) {
523523
struct zcdn_device *zcdndev;
524524

525-
if (mutex_lock_interruptible(&ap_perms_mutex))
526-
return -ERESTARTSYS;
525+
mutex_lock(&ap_perms_mutex);
527526
zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev);
528527
mutex_unlock(&ap_perms_mutex);
529528
if (zcdndev) {

0 commit comments

Comments
 (0)