From: Mike Christie <mchristi@redhat.com>
To: Sun Ke <sunke32@huawei.com>,
josef@toxicpanda.com, axboe@kernel.dk,
linux-block@vger.kernel.org, nbd@other.debian.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
Subject: Re: [v2] nbd:fix memory leak in nbd_get_socket()
Date: Tue, 19 Nov 2019 10:22:51 -0600 [thread overview]
Message-ID: <5DD416DB.1040302@redhat.com> (raw)
In-Reply-To: <1574143751-138680-1-git-send-email-sunke32@huawei.com>
On 11/19/2019 12:09 AM, Sun Ke wrote:
> Before return NULL,put the sock first.
>
> Cc: stable@vger.kernel.org
> Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
> Signed-off-by: Sun Ke <sunke32@huawei.com>
> ---
> v2: add cc:stable tag
> ---
> drivers/block/nbd.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index a94ee45..19e7599 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -993,6 +993,7 @@ static struct socket *nbd_get_socket(struct nbd_device *nbd, unsigned long fd,
> if (sock->ops->shutdown == sock_no_shutdown) {
> dev_err(disk_to_dev(nbd->disk), "Unsupported socket: shutdown callout must be supported.\n");
> *err = -EINVAL;
> + sockfd_put(sock);
> return NULL;
> }
>
>
Reviewed-by: Mike Christie <mchristi@redhat.com>
next prev parent reply other threads:[~2019-11-19 16:23 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-19 6:09 [v2] nbd:fix memory leak in nbd_get_socket() Sun Ke
2019-11-19 16:13 ` Jens Axboe
2019-11-19 16:16 ` Josef Bacik
2019-11-19 16:22 ` Mike Christie [this message]
2019-11-19 16:23 ` Jens Axboe
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=5DD416DB.1040302@redhat.com \
--to=mchristi@redhat.com \
--cc=axboe@kernel.dk \
--cc=josef@toxicpanda.com \
--cc=linux-block@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nbd@other.debian.org \
--cc=stable@vger.kernel.org \
--cc=sunke32@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox