nbd:fix memory leak in nbd_get_socket()
authorSun Ke <sunke32@huawei.com>
Tue, 19 Nov 2019 06:09:11 +0000 (14:09 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:13:13 +0000 (09:13 +0100)
commit97ffb770da162ef71cfc34f9ce4b9542fd2134e1
tree3a3685534abc85f4a74786b9dd8f6c8c14b8672c
parentf71e52cb3270653090cda296b2da02c010aea790
nbd:fix memory leak in nbd_get_socket()

commit dff10bbea4be47bdb615b036c834a275b7c68133 upstream.

Before returning NULL, put the sock first.

Cc: stable@vger.kernel.org
Fixes: cf1b2326b734 ("nbd: verify socket is supported during setup")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Mike Christie <mchristi@redhat.com>
Signed-off-by: Sun Ke <sunke32@huawei.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c