linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] nbd: stop leaking sockets
@ 2017-03-01 16:47 Josef Bacik
  2017-03-01 16:53 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2017-03-01 16:47 UTC (permalink / raw)
  To: axboe, nbd-general, linux-block, kernel-team; +Cc: stable

This was introduced in the multi-connection patch, we've been leaking
socket's ever since.

Fixes: 9561a7a ("nbd: add multi-connection support")
cc: stable@vger.kernel.org
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0bf2b21..c7e93f6 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -689,8 +689,10 @@ static int nbd_clear_sock(struct nbd_device *nbd, struct block_device *bdev)
 	    nbd->num_connections) {
 		int i;
 
-		for (i = 0; i < nbd->num_connections; i++)
+		for (i = 0; i < nbd->num_connections; i++) {
+			sockfd_put(nbd->socks[i]->sock);
 			kfree(nbd->socks[i]);
+		}
 		kfree(nbd->socks);
 		nbd->socks = NULL;
 		nbd->num_connections = 0;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nbd: stop leaking sockets
  2017-03-01 16:47 [PATCH] nbd: stop leaking sockets Josef Bacik
@ 2017-03-01 16:53 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2017-03-01 16:53 UTC (permalink / raw)
  To: Josef Bacik, axboe, nbd-general, linux-block, kernel-team; +Cc: stable

On 03/01/2017 09:47 AM, Josef Bacik wrote:
> This was introduced in the multi-connection patch, we've been leaking
> socket's ever since.
> 
> Fixes: 9561a7a ("nbd: add multi-connection support")
> cc: stable@vger.kernel.org
> Signed-off-by: Josef Bacik <jbacik@fb.com>

Applied for this series, thanks Josef.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-01 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-01 16:47 [PATCH] nbd: stop leaking sockets Josef Bacik
2017-03-01 16:53 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).