Commit 6a8a2154 authored by Josef Bacik's avatar Josef Bacik Committed by Jens Axboe

nbd: stop leaking sockets

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

Fixes: 9561a7ad ("nbd: add multi-connection support")
cc: stable@vger.kernel.org
Signed-off-by: default avatarJosef Bacik <jbacik@fb.com>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 562bef42
...@@ -689,8 +689,10 @@ static int nbd_clear_sock(struct nbd_device *nbd, struct block_device *bdev) ...@@ -689,8 +689,10 @@ static int nbd_clear_sock(struct nbd_device *nbd, struct block_device *bdev)
nbd->num_connections) { nbd->num_connections) {
int i; 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[i]);
}
kfree(nbd->socks); kfree(nbd->socks);
nbd->socks = NULL; nbd->socks = NULL;
nbd->num_connections = 0; nbd->num_connections = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment