netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] netpoll: linearize skb before accessing its data
@ 2013-10-21 21:31 Antonio Quartulli
  2013-10-21 22:23 ` David Miller
  2013-10-21 22:25 ` [PATCH net] netpoll: linearize skb before accessing its data Eric Dumazet
  0 siblings, 2 replies; 24+ messages in thread
From: Antonio Quartulli @ 2013-10-21 21:31 UTC (permalink / raw)
  To: David S. Miller; +Cc: netdev, Antonio Quartulli

__netpoll_rx() assumes that the data buffer of the received
skb is linear and then passes it to rx_hook().
However this is not true because the skb has not been
linearized yet.

This can cause rx_hook() to access non allocated memory
while parsing the received data.

Fix __netpoll_rx() by explicitly linearising the skb.

Signed-off-by: Antonio Quartulli <antonio@meshcoding.com>
---

I checked linux-3.0 and this bug seems to be already there. Please consider
queueing it for stable.


Regards,



 net/core/netpoll.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index fc75c9e..97cff18 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -814,6 +814,9 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
 		if (pskb_trim_rcsum(skb, len))
 			goto out;
 
+		if (skb_linearize(skb))
+			goto out;
+
 		iph = (struct iphdr *)skb->data;
 		if (iph->protocol != IPPROTO_UDP)
 			goto out;
@@ -855,6 +858,8 @@ int __netpoll_rx(struct sk_buff *skb, struct netpoll_info *npinfo)
 			goto out;
 		if (pskb_trim_rcsum(skb, len + sizeof(struct ipv6hdr)))
 			goto out;
+		if (skb_linearize(skb))
+			goto out;
 		ip6h = ipv6_hdr(skb);
 		if (!pskb_may_pull(skb, sizeof(struct udphdr)))
 			goto out;
-- 
1.8.4

^ permalink raw reply related	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2013-10-25 23:27 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-21 21:31 [PATCH net] netpoll: linearize skb before accessing its data Antonio Quartulli
2013-10-21 22:23 ` David Miller
2013-10-22  6:06   ` Antonio Quartulli
2013-10-22  6:25     ` David Miller
2013-10-22  6:37       ` Antonio Quartulli
2013-10-22  6:50         ` David Miller
2013-10-22  8:48           ` [PATCH net] netpoll: fix rx_hook() interface by passing the skb Antonio Quartulli
2013-10-22  9:09             ` David Laight
2013-10-22 10:11               ` Antonio Quartulli
2013-10-22 12:46                 ` David Laight
2013-10-22 17:13                   ` Antonio Quartulli
2013-10-22 19:40                     ` David Miller
2013-10-23  8:33                     ` David Laight
2013-10-23 10:28                       ` Antonio Quartulli
2013-10-23 11:18                         ` David Laight
2013-10-23 12:44                           ` Antonio Quartulli
2013-10-23 20:16                             ` David Miller
2013-10-23 21:36                               ` [PATCHv2 " Antonio Quartulli
2013-10-24  8:43                                 ` David Laight
2013-10-24 12:01                                   ` Antonio Quartulli
2013-10-24 17:53                                   ` David Miller
2013-10-25 23:27                                 ` David Miller
2013-10-21 22:25 ` [PATCH net] netpoll: linearize skb before accessing its data Eric Dumazet
2013-10-21 22:33   ` David Miller

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).