summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJosef Bacik <jbacik@fb.com>2017-03-01 17:47:22 +0100
committerJens Axboe <axboe@fb.com>2017-03-02 16:56:04 +0100
commit6a8a21546507a3ec88e81c2ec927a3fb63efa8ff (patch)
treecba885f516d8dd781fbef2314dda7720f2580633 /drivers/block
parentblk-mq: move update of tags->rqs to __blk_mq_alloc_request() (diff)
downloadlinux-6a8a21546507a3ec88e81c2ec927a3fb63efa8ff.tar.xz
linux-6a8a21546507a3ec88e81c2ec927a3fb63efa8ff.zip
nbd: stop leaking sockets
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> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 0bf2b21a62cb..c7e93f62366f 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;