diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index ac07e8c94c79..f471142d264d 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1004,14 +1004,15 @@ static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg, sockfd_put(sock); return -ENOMEM; } + + config->socks = socks; + nsock = kzalloc(sizeof(struct nbd_sock), GFP_KERNEL); if (!nsock) { sockfd_put(sock); return -ENOMEM; } - config->socks = socks; - nsock->fallback_index = -1; nsock->dead = false; mutex_init(&nsock->tx_lock);