[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20191127203115.750394671@linuxfoundation.org>
Date: Wed, 27 Nov 2019 21:27:44 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Josef Bacik <josef@...icpanda.com>,
Mike Christie <mchristi@...hat.com>,
Sun Ke <sunke32@...wei.com>, Jens Axboe <axboe@...nel.dk>
Subject: [PATCH 4.19 014/306] nbd:fix memory leak in nbd_get_socket()
From: Sun Ke <sunke32@...wei.com>
commit dff10bbea4be47bdb615b036c834a275b7c68133 upstream.
Before returning NULL, put the sock first.
Cc: stable@...r.kernel.org
Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
Reviewed-by: Josef Bacik <josef@...icpanda.com>
Reviewed-by: Mike Christie <mchristi@...hat.com>
Signed-off-by: Sun Ke <sunke32@...wei.com>
Signed-off-by: Jens Axboe <axboe@...nel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/block/nbd.c | 1 +
1 file changed, 1 insertion(+)
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -945,6 +945,7 @@ static struct socket *nbd_get_socket(str
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;
}
Powered by blists - more mailing lists