diff options
-rw-r--r-- | drivers/vhost/net.c | 9 | ||||
-rw-r--r-- | drivers/vhost/vhost.h | 6 |
2 files changed, 8 insertions, 7 deletions
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c index 9b3ca103135f..f616cefc95ba 100644 --- a/drivers/vhost/net.c +++ b/drivers/vhost/net.c | |||
@@ -128,8 +128,7 @@ static void handle_tx(struct vhost_net *net) | |||
128 | size_t hdr_size; | 128 | size_t hdr_size; |
129 | struct socket *sock; | 129 | struct socket *sock; |
130 | 130 | ||
131 | /* TODO: check that we are running from vhost_worker? | 131 | /* TODO: check that we are running from vhost_worker? */ |
132 | * Not sure it's worth it, it's straight-forward enough. */ | ||
133 | sock = rcu_dereference_check(vq->private_data, 1); | 132 | sock = rcu_dereference_check(vq->private_data, 1); |
134 | if (!sock) | 133 | if (!sock) |
135 | return; | 134 | return; |
@@ -306,7 +305,8 @@ static void handle_rx_big(struct vhost_net *net) | |||
306 | size_t len, total_len = 0; | 305 | size_t len, total_len = 0; |
307 | int err; | 306 | int err; |
308 | size_t hdr_size; | 307 | size_t hdr_size; |
309 | struct socket *sock = rcu_dereference(vq->private_data); | 308 | /* TODO: check that we are running from vhost_worker? */ |
309 | struct socket *sock = rcu_dereference_check(vq->private_data, 1); | ||
310 | if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) | 310 | if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) |
311 | return; | 311 | return; |
312 | 312 | ||
@@ -415,7 +415,8 @@ static void handle_rx_mergeable(struct vhost_net *net) | |||
415 | int err, headcount; | 415 | int err, headcount; |
416 | size_t vhost_hlen, sock_hlen; | 416 | size_t vhost_hlen, sock_hlen; |
417 | size_t vhost_len, sock_len; | 417 | size_t vhost_len, sock_len; |
418 | struct socket *sock = rcu_dereference(vq->private_data); | 418 | /* TODO: check that we are running from vhost_worker? */ |
419 | struct socket *sock = rcu_dereference_check(vq->private_data, 1); | ||
419 | if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) | 420 | if (!sock || skb_queue_empty(&sock->sk->sk_receive_queue)) |
420 | return; | 421 | return; |
421 | 422 | ||
diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h index 2af44b7b1f3f..b3363ae38518 100644 --- a/drivers/vhost/vhost.h +++ b/drivers/vhost/vhost.h | |||
@@ -173,9 +173,9 @@ static inline int vhost_has_feature(struct vhost_dev *dev, int bit) | |||
173 | { | 173 | { |
174 | unsigned acked_features; | 174 | unsigned acked_features; |
175 | 175 | ||
176 | acked_features = | 176 | /* TODO: check that we are running from vhost_worker or dev mutex is |
177 | rcu_dereference_index_check(dev->acked_features, | 177 | * held? */ |
178 | lockdep_is_held(&dev->mutex)); | 178 | acked_features = rcu_dereference_index_check(dev->acked_features, 1); |
179 | return acked_features & (1 << bit); | 179 | return acked_features & (1 << bit); |
180 | } | 180 | } |
181 | 181 | ||