diff options
author | Andy Shevchenko | 2023-08-31 13:59:59 +0300 |
---|---|---|
committer | Greg Kroah-Hartman | 2023-09-19 12:28:03 +0200 |
commit | 147d8da33a2c2195ec63acd56cd7d80a3458c253 (patch) | |
tree | 0972a1709c6dddd18fc7e438917a87c5f8a6bacf /drivers/s390 | |
parent | ccb048dae8ffc207d1992caec996dc987bf9fe47 (diff) |
s390/zcrypt: don't leak memory if dev_set_name() fails
[ Upstream commit 6252f47b78031979ad919f971dc8468b893488bd ]
When dev_set_name() fails, zcdn_create() doesn't free the newly
allocated resources. Do it.
Fixes: 00fab2350e6b ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/s390')
-rw-r--r-- | drivers/s390/crypto/zcrypt_api.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/s390/crypto/zcrypt_api.c b/drivers/s390/crypto/zcrypt_api.c index f94b43ce9a65..28e34d155334 100644 --- a/drivers/s390/crypto/zcrypt_api.c +++ b/drivers/s390/crypto/zcrypt_api.c @@ -441,6 +441,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; } |