Commit 6252f47b authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Heiko Carstens

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: 00fab235 ("s390/zcrypt: multiple zcrypt device nodes support")
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230831110000.24279-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarHarald Freudenberger <freude@linux.ibm.com>
Signed-off-by: default avatarHeiko Carstens <hca@linux.ibm.com>
parent 08d90f46
......@@ -413,6 +413,7 @@ static int zcdn_create(const char *name)
ZCRYPT_NAME "_%d", (int)MINOR(devt));
nodename[sizeof(nodename) - 1] = '\0';
if (dev_set_name(&zcdndev->device, nodename)) {
kfree(zcdndev);
rc = -EINVAL;
goto unlockout;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment