diff options
Diffstat (limited to 'net/core/skbuff.c')
-rw-r--r-- | net/core/skbuff.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index ce6356cd9f71..d152394b2611 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -502,7 +502,9 @@ int skb_recycle_check(struct sk_buff *skb, int skb_size) | |||
502 | shinfo->gso_segs = 0; | 502 | shinfo->gso_segs = 0; |
503 | shinfo->gso_type = 0; | 503 | shinfo->gso_type = 0; |
504 | shinfo->ip6_frag_id = 0; | 504 | shinfo->ip6_frag_id = 0; |
505 | shinfo->tx_flags.flags = 0; | ||
505 | shinfo->frag_list = NULL; | 506 | shinfo->frag_list = NULL; |
507 | memset(&shinfo->hwtstamps, 0, sizeof(shinfo->hwtstamps)); | ||
506 | 508 | ||
507 | memset(skb, 0, offsetof(struct sk_buff, tail)); | 509 | memset(skb, 0, offsetof(struct sk_buff, tail)); |
508 | skb->data = skb->head + NET_SKB_PAD; | 510 | skb->data = skb->head + NET_SKB_PAD; |
@@ -1365,9 +1367,8 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i) | |||
1365 | 1367 | ||
1366 | static inline struct page *linear_to_page(struct page *page, unsigned int *len, | 1368 | static inline struct page *linear_to_page(struct page *page, unsigned int *len, |
1367 | unsigned int *offset, | 1369 | unsigned int *offset, |
1368 | struct sk_buff *skb) | 1370 | struct sk_buff *skb, struct sock *sk) |
1369 | { | 1371 | { |
1370 | struct sock *sk = skb->sk; | ||
1371 | struct page *p = sk->sk_sndmsg_page; | 1372 | struct page *p = sk->sk_sndmsg_page; |
1372 | unsigned int off; | 1373 | unsigned int off; |
1373 | 1374 | ||
@@ -1405,13 +1406,14 @@ new_page: | |||
1405 | */ | 1406 | */ |
1406 | static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page, | 1407 | static inline int spd_fill_page(struct splice_pipe_desc *spd, struct page *page, |
1407 | unsigned int *len, unsigned int offset, | 1408 | unsigned int *len, unsigned int offset, |
1408 | struct sk_buff *skb, int linear) | 1409 | struct sk_buff *skb, int linear, |
1410 | struct sock *sk) | ||
1409 | { | 1411 | { |
1410 | if (unlikely(spd->nr_pages == PIPE_BUFFERS)) | 1412 | if (unlikely(spd->nr_pages == PIPE_BUFFERS)) |
1411 | return 1; | 1413 | return 1; |
1412 | 1414 | ||
1413 | if (linear) { | 1415 | if (linear) { |
1414 | page = linear_to_page(page, len, &offset, skb); | 1416 | page = linear_to_page(page, len, &offset, skb, sk); |
1415 | if (!page) | 1417 | if (!page) |
1416 | return 1; | 1418 | return 1; |
1417 | } else | 1419 | } else |
@@ -1442,7 +1444,8 @@ static inline void __segment_seek(struct page **page, unsigned int *poff, | |||
1442 | static inline int __splice_segment(struct page *page, unsigned int poff, | 1444 | static inline int __splice_segment(struct page *page, unsigned int poff, |
1443 | unsigned int plen, unsigned int *off, | 1445 | unsigned int plen, unsigned int *off, |
1444 | unsigned int *len, struct sk_buff *skb, | 1446 | unsigned int *len, struct sk_buff *skb, |
1445 | struct splice_pipe_desc *spd, int linear) | 1447 | struct splice_pipe_desc *spd, int linear, |
1448 | struct sock *sk) | ||
1446 | { | 1449 | { |
1447 | if (!*len) | 1450 | if (!*len) |
1448 | return 1; | 1451 | return 1; |
@@ -1465,7 +1468,7 @@ static inline int __splice_segment(struct page *page, unsigned int poff, | |||
1465 | /* the linear region may spread across several pages */ | 1468 | /* the linear region may spread across several pages */ |
1466 | flen = min_t(unsigned int, flen, PAGE_SIZE - poff); | 1469 | flen = min_t(unsigned int, flen, PAGE_SIZE - poff); |
1467 | 1470 | ||
1468 | if (spd_fill_page(spd, page, &flen, poff, skb, linear)) | 1471 | if (spd_fill_page(spd, page, &flen, poff, skb, linear, sk)) |
1469 | return 1; | 1472 | return 1; |
1470 | 1473 | ||
1471 | __segment_seek(&page, &poff, &plen, flen); | 1474 | __segment_seek(&page, &poff, &plen, flen); |
@@ -1481,8 +1484,8 @@ static inline int __splice_segment(struct page *page, unsigned int poff, | |||
1481 | * pipe is full or if we already spliced the requested length. | 1484 | * pipe is full or if we already spliced the requested length. |
1482 | */ | 1485 | */ |
1483 | static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | 1486 | static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, |
1484 | unsigned int *len, | 1487 | unsigned int *len, struct splice_pipe_desc *spd, |
1485 | struct splice_pipe_desc *spd) | 1488 | struct sock *sk) |
1486 | { | 1489 | { |
1487 | int seg; | 1490 | int seg; |
1488 | 1491 | ||
@@ -1492,7 +1495,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1492 | if (__splice_segment(virt_to_page(skb->data), | 1495 | if (__splice_segment(virt_to_page(skb->data), |
1493 | (unsigned long) skb->data & (PAGE_SIZE - 1), | 1496 | (unsigned long) skb->data & (PAGE_SIZE - 1), |
1494 | skb_headlen(skb), | 1497 | skb_headlen(skb), |
1495 | offset, len, skb, spd, 1)) | 1498 | offset, len, skb, spd, 1, sk)) |
1496 | return 1; | 1499 | return 1; |
1497 | 1500 | ||
1498 | /* | 1501 | /* |
@@ -1502,7 +1505,7 @@ static int __skb_splice_bits(struct sk_buff *skb, unsigned int *offset, | |||
1502 | const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; | 1505 | const skb_frag_t *f = &skb_shinfo(skb)->frags[seg]; |
1503 | 1506 | ||
1504 | if (__splice_segment(f->page, f->page_offset, f->size, | 1507 | if (__splice_segment(f->page, f->page_offset, f->size, |
1505 | offset, len, skb, spd, 0)) | 1508 | offset, len, skb, spd, 0, sk)) |
1506 | return 1; | 1509 | return 1; |
1507 | } | 1510 | } |
1508 | 1511 | ||
@@ -1528,12 +1531,13 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset, | |||
1528 | .ops = &sock_pipe_buf_ops, | 1531 | .ops = &sock_pipe_buf_ops, |
1529 | .spd_release = sock_spd_release, | 1532 | .spd_release = sock_spd_release, |
1530 | }; | 1533 | }; |
1534 | struct sock *sk = skb->sk; | ||
1531 | 1535 | ||
1532 | /* | 1536 | /* |
1533 | * __skb_splice_bits() only fails if the output has no room left, | 1537 | * __skb_splice_bits() only fails if the output has no room left, |
1534 | * so no point in going over the frag_list for the error case. | 1538 | * so no point in going over the frag_list for the error case. |
1535 | */ | 1539 | */ |
1536 | if (__skb_splice_bits(skb, &offset, &tlen, &spd)) | 1540 | if (__skb_splice_bits(skb, &offset, &tlen, &spd, sk)) |
1537 | goto done; | 1541 | goto done; |
1538 | else if (!tlen) | 1542 | else if (!tlen) |
1539 | goto done; | 1543 | goto done; |
@@ -1545,14 +1549,13 @@ int skb_splice_bits(struct sk_buff *skb, unsigned int offset, | |||
1545 | struct sk_buff *list = skb_shinfo(skb)->frag_list; | 1549 | struct sk_buff *list = skb_shinfo(skb)->frag_list; |
1546 | 1550 | ||
1547 | for (; list && tlen; list = list->next) { | 1551 | for (; list && tlen; list = list->next) { |
1548 | if (__skb_splice_bits(list, &offset, &tlen, &spd)) | 1552 | if (__skb_splice_bits(list, &offset, &tlen, &spd, sk)) |
1549 | break; | 1553 | break; |
1550 | } | 1554 | } |
1551 | } | 1555 | } |
1552 | 1556 | ||
1553 | done: | 1557 | done: |
1554 | if (spd.nr_pages) { | 1558 | if (spd.nr_pages) { |
1555 | struct sock *sk = skb->sk; | ||
1556 | int ret; | 1559 | int ret; |
1557 | 1560 | ||
1558 | /* | 1561 | /* |