stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Eric Dumazet <edumazet@google.com>, Willy Tarreau <w@1wt.eu>,
	"David S. Miller" <davem@davemloft.net>
Subject: [PATCH 77/86] net: splice: fix __splice_segment()
Date: Tue, 26 Mar 2013 13:22:16 -0400	[thread overview]
Message-ID: <20130326173612.141152254@goodmis.org> (raw)
In-Reply-To: 20130326172059.136127374@goodmis.org

[-- Attachment #1: 0077-net-splice-fix-__splice_segment.patch --]
[-- Type: text/plain, Size: 3368 bytes --]

3.6.11.1 stable review patch.
If anyone has any objections, please let me know.

------------------

From: Eric Dumazet <edumazet@google.com>

[ Upstream commit 9049d7450887d54b199441144f8ba50fa4d8cf92 ]

commit 9ca1b22d6d2 (net: splice: avoid high order page splitting)
forgot that skb->head could need a copy into several page frags.

This could be the case for loopback traffic mostly.

Also remove now useless skb argument from linear_to_page()
and __splice_segment() prototypes.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Willy Tarreau <w@1wt.eu>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 net/core/skbuff.c |   28 +++++++++++++++-------------
 1 file changed, 15 insertions(+), 13 deletions(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 8e6a22c..043139d01 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -1606,7 +1606,7 @@ static void sock_spd_release(struct splice_pipe_desc *spd, unsigned int i)
 
 static struct page *linear_to_page(struct page *page, unsigned int *len,
 				   unsigned int *offset,
-				   struct sk_buff *skb, struct sock *sk)
+				   struct sock *sk)
 {
 	struct page *p = sk->sk_sndmsg_page;
 	unsigned int off;
@@ -1658,14 +1658,14 @@ static bool spd_can_coalesce(const struct splice_pipe_desc *spd,
 static bool spd_fill_page(struct splice_pipe_desc *spd,
 			  struct pipe_inode_info *pipe, struct page *page,
 			  unsigned int *len, unsigned int offset,
-			  struct sk_buff *skb, bool linear,
+			  bool linear,
 			  struct sock *sk)
 {
 	if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
 		return true;
 
 	if (linear) {
-		page = linear_to_page(page, len, &offset, skb, sk);
+		page = linear_to_page(page, len, &offset, sk);
 		if (!page)
 			return true;
 	}
@@ -1684,13 +1684,11 @@ static bool spd_fill_page(struct splice_pipe_desc *spd,
 
 static bool __splice_segment(struct page *page, unsigned int poff,
 			     unsigned int plen, unsigned int *off,
-			     unsigned int *len, struct sk_buff *skb,
+			     unsigned int *len,
 			     struct splice_pipe_desc *spd, bool linear,
 			     struct sock *sk,
 			     struct pipe_inode_info *pipe)
 {
-	unsigned int flen;
-
 	if (!*len)
 		return true;
 
@@ -1705,12 +1703,16 @@ static bool __splice_segment(struct page *page, unsigned int poff,
 	plen -= *off;
 	*off = 0;
 
-	flen = min(*len, plen);
-
-	if (spd_fill_page(spd, pipe, page, &flen, poff, skb, linear, sk))
-		return true;
+	do {
+		unsigned int flen = min(*len, plen);
 
-	*len -= flen;
+		if (spd_fill_page(spd, pipe, page, &flen, poff,
+				  linear, sk))
+			return true;
+		poff += flen;
+		plen -= flen;
+		*len -= flen;
+	} while (*len && plen);
 
 	return false;
 }
@@ -1733,7 +1735,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 	if (__splice_segment(virt_to_page(skb->data),
 			     (unsigned long) skb->data & (PAGE_SIZE - 1),
 			     skb_headlen(skb),
-			     offset, len, skb, spd,
+			     offset, len, spd,
 			     skb_head_is_locked(skb),
 			     sk, pipe))
 		return true;
@@ -1746,7 +1748,7 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
 
 		if (__splice_segment(skb_frag_page(f),
 				     f->page_offset, skb_frag_size(f),
-				     offset, len, skb, spd, false, sk, pipe))
+				     offset, len, spd, false, sk, pipe))
 			return true;
 	}
 
-- 
1.7.10.4



  parent reply	other threads:[~2013-03-26 17:22 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-26 17:20 [PATCH 00/86] [ANNOUNCE] The new 3.6.11.x short-term extended stable series (stable review) Steven Rostedt
2013-03-26 17:21 ` [PATCH 01/86] sparc: huge_ptep_set_* functions need to call set_huge_pte_at() Steven Rostedt
2013-03-26 17:21 ` [PATCH 02/86] batman-adv: fix random jitter calculation Steven Rostedt
2013-03-26 17:21 ` [PATCH 03/86] inet: Fix kmemleak in tcp_v4/6_syn_recv_sock and dccp_v4/6_request_recv_sock Steven Rostedt
2013-03-26 17:21 ` [PATCH 04/86] net: sched: integer overflow fix Steven Rostedt
2013-03-26 17:21 ` [PATCH 05/86] tcp: fix MSG_SENDPAGE_NOTLAST logic Steven Rostedt
2013-03-26 17:21 ` [PATCH 06/86] tcp: tcp_replace_ts_recent() should not be called from tcp_validate_incoming() Steven Rostedt
2013-03-26 17:21 ` [PATCH 07/86] tcp: RFC 5961 5.2 Blind Data Injection Attack Mitigation Steven Rostedt
2013-03-26 17:21 ` [PATCH 08/86] net: prevent setting ttl=0 via IP_TTL Steven Rostedt
2013-03-26 17:21 ` [PATCH 09/86] ipv6: fix the noflags test in addrconf_get_prefix_route Steven Rostedt
2013-03-26 17:21 ` [PATCH 10/86] MAINTAINERS: Stephen Hemminger email change Steven Rostedt
2013-03-26 17:21 ` [PATCH 11/86] ipv6: fix header length calculation in ip6_append_data() Steven Rostedt
2013-03-26 17:21 ` [PATCH 12/86] net: calxedaxgmac: throw away overrun frames Steven Rostedt
2013-03-26 17:21 ` [PATCH 13/86] net/mlx4_en: Fix bridged vSwitch configuration for non SRIOV mode Steven Rostedt
2013-03-26 17:21 ` [PATCH 14/86] net/mlx4_core: Set number of msix vectors under SRIOV mode to firmware defaults Steven Rostedt
2013-03-26 17:21 ` [PATCH 15/86] isdn/gigaset: fix zero size border case in debug dump Steven Rostedt
2013-03-26 17:21 ` [PATCH 16/86] netxen: fix off by one bug in netxen_release_tx_buffer() Steven Rostedt
2013-03-26 17:21 ` [PATCH 17/86] r8169: remove the obsolete and incorrect AMD workaround Steven Rostedt
2013-03-26 17:21 ` [PATCH 18/86] net: loopback: fix a dst refcounting issue Steven Rostedt
2013-03-26 17:21 ` [PATCH 19/86] pktgen: correctly handle failures when adding a device Steven Rostedt
2013-03-26 17:21 ` [PATCH 20/86] ipv6: do not create neighbor entries for local delivery Steven Rostedt
2013-03-26 17:21 ` [PATCH 21/86] via-rhine: Fix bugs in NAPI support Steven Rostedt
2013-03-26 17:21 ` [PATCH 22/86] packet: fix leakage of tx_ring memory Steven Rostedt
2013-03-26 17:21 ` [PATCH 23/86] atm/iphase: rename fregt_t -> ffreg_t Steven Rostedt
2013-03-26 17:21 ` [PATCH 24/86] sctp: refactor sctp_outq_teardown to insure proper re-initalization Steven Rostedt
2013-03-26 17:21 ` [PATCH 25/86] net: sctp: sctp_setsockopt_auth_key: use kzfree instead of kfree Steven Rostedt
2013-03-26 17:21 ` [PATCH 26/86] net: sctp: sctp_endpoint_free: zero out secret key data Steven Rostedt
2013-03-26 17:21 ` [PATCH 27/86] xen/netback: shutdown the ring if it contains garbage Steven Rostedt
2013-03-26 17:21 ` [PATCH 28/86] xen/netback: dont leak pages on failure in xen_netbk_tx_check_gop Steven Rostedt
2013-03-26 17:21 ` [PATCH 29/86] xen/netback: free already allocated memory on failure in xen_netbk_get_requests Steven Rostedt
2013-03-26 17:21 ` [PATCH 30/86] netback: correct netbk_tx_err to handle wrap around Steven Rostedt
2013-03-26 17:21 ` [PATCH 31/86] tcp: frto should not set snd_cwnd to 0 Steven Rostedt
2013-03-26 17:21 ` [PATCH 32/86] tcp: fix for zero packets_in_flight was too broad Steven Rostedt
2013-03-26 17:21 ` [PATCH 33/86] bridge: Pull ip header into skb->data before looking into ip header Steven Rostedt
2013-03-26 17:21 ` [PATCH 34/86] tg3: Avoid null pointer dereference in tg3_interrupt in netconsole mode Steven Rostedt
2013-03-26 17:21 ` [PATCH 35/86] tg3: Fix crc errors on jumbo frame receive Steven Rostedt
2013-03-26 17:21 ` [PATCH 36/86] sunvdc: Fix off-by-one in generic_request() Steven Rostedt
2013-03-26 17:21 ` [PATCH 37/86] bridge: set priority of STP packets Steven Rostedt
2013-03-26 17:21 ` [PATCH 38/86] net: fix infinite loop in __skb_recv_datagram() Steven Rostedt
2013-03-26 17:21 ` [PATCH 39/86] xen-netback: correctly return errors from netbk_count_requests() Steven Rostedt
2013-03-26 17:21 ` [PATCH 40/86] xen-netback: cancel the credit timer when taking the vif down Steven Rostedt
2013-03-26 17:21 ` [PATCH 41/86] net: fix a compile error when SOCK_REFCNT_DEBUG is enabled Steven Rostedt
2013-03-26 17:21 ` [PATCH 42/86] ipv4: fix a bug in ping_err() Steven Rostedt
2013-03-26 17:21 ` [PATCH 43/86] ipv6: use a stronger hash for tcp Steven Rostedt
2013-03-26 17:21 ` [PATCH 44/86] sock_diag: Fix out-of-bounds access to sock_diag_handlers[] Steven Rostedt
2013-03-26 17:21 ` [PATCH 45/86] vlan: adjust vlan_set_encap_proto() for its callers Steven Rostedt
2013-03-26 17:21 ` [PATCH 46/86] l2tp: Restore socket refcount when sendmsg succeeds Steven Rostedt
2013-03-26 17:21 ` [PATCH 47/86] rds: limit the size allocated by rds_message_alloc() Steven Rostedt
2013-03-26 17:21 ` [PATCH 48/86] net: ipv6: Dont purge default router if accept_ra=2 Steven Rostedt
2013-03-26 17:21 ` [PATCH 49/86] tcp: fix double-counted receiver RTT when leaving receiver fast path Steven Rostedt
2013-03-26 17:21 ` [PATCH 50/86] tun: add a missing nf_reset() in tun_net_xmit() Steven Rostedt
2013-03-26 17:21 ` [PATCH 51/86] macvlan: Set IFF_UNICAST_FLT flag to prevent unnecessary promisc mode Steven Rostedt
2013-03-26 17:21 ` [PATCH 52/86] netlabel: fix build problems when CONFIG_IPV6=n Steven Rostedt
2013-03-26 17:21 ` [PATCH 53/86] netlabel: correctly list all the static label mappings Steven Rostedt
2013-03-26 17:21 ` [PATCH 54/86] bridging: fix rx_handlers return code Steven Rostedt
2013-03-26 17:21 ` [PATCH 55/86] ipv6: stop multicast forwarding to process interface scoped addresses Steven Rostedt
2013-03-26 17:21 ` [PATCH 56/86] rtnl: fix info leak on RTM_GETLINK request for VF devices Steven Rostedt
2013-03-26 17:21 ` [PATCH 57/86] dcbnl: fix various netlink info leaks Steven Rostedt
2013-03-26 17:21 ` [PATCH 58/86] 6lowpan: Fix endianness issue in is_addr_link_local() Steven Rostedt
2013-03-26 17:21 ` [PATCH 59/86] ipv6: Change skb->data before using icmpv6_notify() to propagate redirect Steven Rostedt
2013-03-26 17:21 ` [PATCH 60/86] mac802154: fix NOHZ local_softirq_pending 08 warning Steven Rostedt
2013-03-26 17:22 ` [PATCH 61/86] sctp: jsctp_sf_eat_sack: fix jprobes function signature mismatch Steven Rostedt
2013-03-26 17:22 ` [PATCH 62/86] macvlan: fix macvlan_get_size() Steven Rostedt
2013-03-26 17:22 ` [PATCH 63/86] tcp: fix incorrect LOCKDROPPEDICMPS counter Steven Rostedt
2013-03-26 17:22 ` [PATCH 64/86] IP_GRE: Fix kernel panic in IP_GRE with GRE csum Steven Rostedt
2013-03-27  4:28   ` Ben Hutchings
2013-03-27  4:35     ` Steven Rostedt
2013-03-26 17:22 ` [PATCH 65/86] ipv4: Remove output route check in ipv4_mtu Steven Rostedt
2013-03-26 17:22 ` [PATCH 66/86] ipv4: Dont update the pmtu on mtu locked routes Steven Rostedt
2013-03-26 17:22 ` [PATCH 67/86] ipv6: Add an error handler for icmp6 Steven Rostedt
2013-03-26 17:22 ` [PATCH 68/86] ipv4: Invalidate the socket cached route on pmtu events if possible Steven Rostedt
2013-03-26 17:22 ` [PATCH 69/86] ipv4: Add a socket release callback for datagram sockets Steven Rostedt
2013-03-26 17:22 ` [PATCH 70/86] ipv4: Fix route refcount on pmtu discovery Steven Rostedt
2013-03-26 17:22 ` [PATCH 71/86] tcp: detect SYN/data drop when F-RTO is disabled Steven Rostedt
2013-03-26 17:22 ` [PATCH 72/86] tcp: fix an infinite loop in tcp_slow_start() Steven Rostedt
2013-03-26 17:22 ` [PATCH 73/86] tcp: dont abort splice() after small transfers Steven Rostedt
2013-03-26 17:22 ` [PATCH 74/86] tcp: splice: fix an infinite loop in tcp_read_sock() Steven Rostedt
2013-03-26 17:22 ` [PATCH 75/86] tcp: fix splice() and tcp collapsing interaction Steven Rostedt
2013-03-26 17:22 ` [PATCH 76/86] net: splice: avoid high order page splitting Steven Rostedt
2013-03-26 17:22 ` Steven Rostedt [this message]
2013-03-26 17:22 ` [PATCH 78/86] sparc64: Add missing HAVE_ARCH_TRANSPARENT_HUGEPAGE Steven Rostedt
2013-03-26 17:22 ` [PATCH 79/86] sparc64: Fix gfp_flags setting in tsb_grow() Steven Rostedt
2013-03-26 17:22 ` [PATCH 80/86] xfrm: release neighbor upon dst destruction Steven Rostedt
2013-03-26 17:22 ` [PATCH 81/86] ppp: set qdisc_tx_busylock to avoid LOCKDEP splat Steven Rostedt
2013-03-26 17:22 ` [PATCH 82/86] ipv6: fix race condition regarding dst->expires and dst->from Steven Rostedt
2013-03-26 17:22 ` [PATCH 83/86] ipv4: fix error handling in icmp_protocol Steven Rostedt
2013-03-26 17:22 ` [PATCH 84/86] tcp: fix SYN-data space mis-accounting Steven Rostedt
2013-03-26 17:22 ` [PATCH 85/86] mlx4_en: fix allocation of CPU affinity reverse-map Steven Rostedt
2013-03-28  8:47   ` Amir Vadai
2013-03-26 17:22 ` [PATCH 86/86] team: unsyc the devices addresses when port is removed Steven Rostedt
2013-03-26 17:46 ` [PATCH 00/86] [ANNOUNCE] The new 3.6.11.x short-term extended stable series (stable review) Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130326173612.141152254@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).