[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d68d17be-0c4e-1286-4327-0e3ba6600eca@kernel.dk>
Date: Tue, 19 Nov 2019 09:13:34 -0700
From: Jens Axboe <axboe@...nel.dk>
To: Sun Ke <sunke32@...wei.com>, josef@...icpanda.com,
linux-block@...r.kernel.org, nbd@...er.debian.org,
linux-kernel@...r.kernel.org
Cc: Mike Christie <mchristi@...hat.com>
Subject: Re: [v2] nbd:fix memory leak in nbd_get_socket()
On 11/18/19 11:09 PM, Sun Ke wrote:
> Before return NULL,put the sock first.
>
> Cc: stable@...r.kernel.org
> Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
> Signed-off-by: Sun Ke <sunke32@...wei.com>
Please always CC the author of the patch you're fixing.
Mike, Josef - we probably need to get this upstream ASAP.
> ---
> 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;
> }
>
>
--
Jens Axboe
Powered by blists - more mailing lists