Commit 09aaacf0 authored by Al Viro's avatar Al Viro

vhost: don't open-code sockfd_put()

Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 964ea96e
...@@ -818,9 +818,9 @@ static int vhost_net_release(struct inode *inode, struct file *f) ...@@ -818,9 +818,9 @@ static int vhost_net_release(struct inode *inode, struct file *f)
vhost_dev_cleanup(&n->dev, false); vhost_dev_cleanup(&n->dev, false);
vhost_net_vq_reset(n); vhost_net_vq_reset(n);
if (tx_sock) if (tx_sock)
fput(tx_sock->file); sockfd_put(tx_sock);
if (rx_sock) if (rx_sock)
fput(rx_sock->file); sockfd_put(rx_sock);
/* Make sure no callbacks are outstanding */ /* Make sure no callbacks are outstanding */
synchronize_rcu_bh(); synchronize_rcu_bh();
/* We do an extra flush before freeing memory, /* We do an extra flush before freeing memory,
...@@ -860,7 +860,7 @@ static struct socket *get_raw_socket(int fd) ...@@ -860,7 +860,7 @@ static struct socket *get_raw_socket(int fd)
} }
return sock; return sock;
err: err:
fput(sock->file); sockfd_put(sock);
return ERR_PTR(r); return ERR_PTR(r);
} }
...@@ -966,7 +966,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) ...@@ -966,7 +966,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
if (oldsock) { if (oldsock) {
vhost_net_flush_vq(n, index); vhost_net_flush_vq(n, index);
fput(oldsock->file); sockfd_put(oldsock);
} }
mutex_unlock(&n->dev.mutex); mutex_unlock(&n->dev.mutex);
...@@ -978,7 +978,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd) ...@@ -978,7 +978,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
if (ubufs) if (ubufs)
vhost_net_ubuf_put_wait_and_free(ubufs); vhost_net_ubuf_put_wait_and_free(ubufs);
err_ubufs: err_ubufs:
fput(sock->file); sockfd_put(sock);
err_vq: err_vq:
mutex_unlock(&vq->mutex); mutex_unlock(&vq->mutex);
err: err:
...@@ -1009,9 +1009,9 @@ static long vhost_net_reset_owner(struct vhost_net *n) ...@@ -1009,9 +1009,9 @@ static long vhost_net_reset_owner(struct vhost_net *n)
done: done:
mutex_unlock(&n->dev.mutex); mutex_unlock(&n->dev.mutex);
if (tx_sock) if (tx_sock)
fput(tx_sock->file); sockfd_put(tx_sock);
if (rx_sock) if (rx_sock)
fput(rx_sock->file); sockfd_put(rx_sock);
return err; return err;
} }
......
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