All of lore.kernel.org
 help / color / mirror / Atom feed
From: Harald Freudenberger <freude@linux.ibm.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	Heiko Carstens <hca@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Alexander Gordeev <agordeev@linux.ibm.com>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>
Subject: Re: [PATCH v1 1/2] s390/zcrtpt: Don't leak memory if dev_set_name() fails
Date: Mon, 04 Sep 2023 09:20:22 +0200	[thread overview]
Message-ID: <d8c5522ddfe034e839cc93e8b4ef36fb@linux.ibm.com> (raw)
In-Reply-To: <20230831110000.24279-1-andriy.shevchenko@linux.intel.com>

On 2023-08-31 12:59, Andy Shevchenko wrote:
> When dev_set_name() fails, the 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>
> ---
>  drivers/s390/crypto/zcrypt_api.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/s390/crypto/zcrypt_api.c 
> b/drivers/s390/crypto/zcrypt_api.c
> index 4b23c9f7f3e5..6b99f7dd0643 100644
> --- a/drivers/s390/crypto/zcrypt_api.c
> +++ b/drivers/s390/crypto/zcrypt_api.c
> @@ -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;
>  	}
Thanks Andy, I picked this patch and forwarded it into the s390 
subsystem.
This will be visible in Linus' kernel tree with the next merge.

      parent reply	other threads:[~2023-09-04  7:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-31 10:59 [PATCH v1 1/2] s390/zcrtpt: Don't leak memory if dev_set_name() fails Andy Shevchenko
2023-08-31 11:00 ` [PATCH v1 2/2] s390/zcrypt: Utilize dev_set_name() ability to use a formatted string Andy Shevchenko
2023-09-04  7:20 ` Harald Freudenberger [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d8c5522ddfe034e839cc93e8b4ef36fb@linux.ibm.com \
    --to=freude@linux.ibm.com \
    --cc=agordeev@linux.ibm.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.