Skip to content

Commit 6252f47

Browse files
andy-shevhcahca
authored andcommitted
s390/zcrypt: don't leak memory if dev_set_name() fails
When dev_set_name() fails, zcdn_create() doesn't free the newly allocated resources. Do it. Fixes: 00fab23 ("s390/zcrypt: multiple zcrypt device nodes support") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230831110000.24279-1-andriy.shevchenko@linux.intel.com Signed-off-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 08d90f4 commit 6252f47

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/s390/crypto/zcrypt_api.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,7 @@ static int zcdn_create(const char *name)
413413
ZCRYPT_NAME "_%d", (int)MINOR(devt));
414414
nodename[sizeof(nodename) - 1] = '\0';
415415
if (dev_set_name(&zcdndev->device, nodename)) {
416+
kfree(zcdndev);
416417
rc = -EINVAL;
417418
goto unlockout;
418419
}

0 commit comments

Comments
 (0)