diff options
author | Johan Hovold <johan@kernel.org> | 2019-10-10 15:13:33 +0200 |
---|---|---|
committer | Vasily Gorbik <gor@linux.ibm.com> | 2019-10-22 17:55:51 +0200 |
commit | 388bb19be8eab4674a660e0c97eaf60775362bc7 (patch) | |
tree | 0981cf6223bc6919945797fb5e1da8a4f6de73e9 /drivers/s390/crypto/zcrypt_api.c | |
parent | 7d194c2100ad2a6dded545887d02754948ca5241 (diff) | |
download | linux-388bb19be8eab4674a660e0c97eaf60775362bc7.tar.bz2 |
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: 00fab2350e6b ("s390/zcrypt: multiple zcrypt device nodes support")
Cc: <stable@vger.kernel.org> # 4.19
Cc: Harald Freudenberger <freude@linux.ibm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Diffstat (limited to 'drivers/s390/crypto/zcrypt_api.c')
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index 45bdb47f84c1..9157e728a362 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -522,8 +522,7 @@ static int zcrypt_release(struct inode *inode, struct file *filp) if (filp->f_inode->i_cdev == &zcrypt_cdev) { struct zcdn_device *zcdndev; - if (mutex_lock_interruptible(&ap_perms_mutex)) - return -ERESTARTSYS; + mutex_lock(&ap_perms_mutex); zcdndev = find_zcdndev_by_devt(filp->f_inode->i_rdev); mutex_unlock(&ap_perms_mutex); if (zcdndev) { |