aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/9p/trans_virtio.c8
-rw-r--r--net/core/skbuff.c29
2 files changed, 32 insertions, 5 deletions
diff --git a/net/9p/trans_virtio.c b/net/9p/trans_virtio.c
index 40b71a29fc3f..42eea5fe2628 100644
--- a/net/9p/trans_virtio.c
+++ b/net/9p/trans_virtio.c
@@ -199,14 +199,12 @@ static void p9_virtio_close(struct p9_trans *trans)
199 kfree(trans); 199 kfree(trans);
200} 200}
201 201
202static bool p9_virtio_intr(struct virtqueue *q) 202static void p9_virtio_intr(struct virtqueue *q)
203{ 203{
204 struct virtio_chan *chan = q->vdev->priv; 204 struct virtio_chan *chan = q->vdev->priv;
205 205
206 P9_DPRINTK(P9_DEBUG_TRANS, "9p poll_wakeup: %p\n", &chan->wq); 206 P9_DPRINTK(P9_DEBUG_TRANS, "9p poll_wakeup: %p\n", &chan->wq);
207 wake_up_interruptible(&chan->wq); 207 wake_up_interruptible(&chan->wq);
208
209 return true;
210} 208}
211 209
212static int p9_virtio_probe(struct virtio_device *dev) 210static int p9_virtio_probe(struct virtio_device *dev)
@@ -236,13 +234,13 @@ static int p9_virtio_probe(struct virtio_device *dev)
236 234
237 /* Find the input queue. */ 235 /* Find the input queue. */
238 dev->priv = chan; 236 dev->priv = chan;
239 chan->in_vq = dev->config->find_vq(dev, p9_virtio_intr); 237 chan->in_vq = dev->config->find_vq(dev, 0, p9_virtio_intr);
240 if (IS_ERR(chan->in_vq)) { 238 if (IS_ERR(chan->in_vq)) {
241 err = PTR_ERR(chan->in_vq); 239 err = PTR_ERR(chan->in_vq);
242 goto free; 240 goto free;
243 } 241 }
244 242
245 chan->out_vq = dev->config->find_vq(dev, NULL); 243 chan->out_vq = dev->config->find_vq(dev, 1, NULL);
246 if (IS_ERR(chan->out_vq)) { 244 if (IS_ERR(chan->out_vq)) {
247 err = PTR_ERR(chan->out_vq); 245 err = PTR_ERR(chan->out_vq);
248 goto free_in_vq; 246 goto free_in_vq;
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 98420f9c4b6d..4e354221ec23 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2461,6 +2461,34 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
2461 return elt; 2461 return elt;
2462} 2462}
2463 2463
2464/**
2465 * skb_partial_csum_set - set up and verify partial csum values for packet
2466 * @skb: the skb to set
2467 * @start: the number of bytes after skb->data to start checksumming.
2468 * @off: the offset from start to place the checksum.
2469 *
2470 * For untrusted partially-checksummed packets, we need to make sure the values
2471 * for skb->csum_start and skb->csum_offset are valid so we don't oops.
2472 *
2473 * This function checks and sets those values and skb->ip_summed: if this
2474 * returns false you should drop the packet.
2475 */
2476bool skb_partial_csum_set(struct sk_buff *skb, u16 start, u16 off)
2477{
2478 if (unlikely(start > skb->len - 2) ||
2479 unlikely((int)start + off > skb->len - 2)) {
2480 if (net_ratelimit())
2481 printk(KERN_WARNING
2482 "bad partial csum: csum=%u/%u len=%u\n",
2483 start, off, skb->len);
2484 return false;
2485 }
2486 skb->ip_summed = CHECKSUM_PARTIAL;
2487 skb->csum_start = skb_headroom(skb) + start;
2488 skb->csum_offset = off;
2489 return true;
2490}
2491
2464EXPORT_SYMBOL(___pskb_trim); 2492EXPORT_SYMBOL(___pskb_trim);
2465EXPORT_SYMBOL(__kfree_skb); 2493EXPORT_SYMBOL(__kfree_skb);
2466EXPORT_SYMBOL(kfree_skb); 2494EXPORT_SYMBOL(kfree_skb);
@@ -2497,3 +2525,4 @@ EXPORT_SYMBOL(skb_append_datato_frags);
2497 2525
2498EXPORT_SYMBOL_GPL(skb_to_sgvec); 2526EXPORT_SYMBOL_GPL(skb_to_sgvec);
2499EXPORT_SYMBOL_GPL(skb_cow_data); 2527EXPORT_SYMBOL_GPL(skb_cow_data);
2528EXPORT_SYMBOL_GPL(skb_partial_csum_set);