public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb->data assignment
@ 2012-06-14 20:21 Antonio Quartulli
  2012-06-15 11:45 ` Sven Eckelmann
  2012-06-15 19:09 ` Marek Lindner
  0 siblings, 2 replies; 12+ messages in thread
From: Antonio Quartulli @ 2012-06-14 20:21 UTC (permalink / raw)
  To: b.a.t.m.a.n

skb_linearize(skb) possibly rearranges the skb internal data and then changes
the skb->data pointer value. For this reason any other pointer in the code that
was assigned skb->data before invoking skb_linearise(skb) must be re-assigned.

In the current tt_query message handling code this is not done and therefore, in
case of skb linearization, the pointer used to handle the packet header ends up
in pointing to poisoned memory. The packet is then dropped but the
translation-table mechanism is corrupted.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---

*** this patch is an important fix and it is for maint ***

 routing.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/routing.c b/routing.c
index be068f3..b79e42e 100644
--- a/routing.c
+++ b/routing.c
@@ -638,6 +638,8 @@ int batadv_recv_tt_query(struct sk_buff *skb, struct batadv_hard_iface *recv_if)
 			 */
 			if (skb_linearize(skb) < 0)
 				goto out;
+			/* skb_linearize() possibly changed skb->data */
+			tt_query = (struct batadv_tt_query_packet *)skb->data;
 
 			tt_size = batadv_tt_len(ntohs(tt_query->tt_data));
 
-- 
1.7.9.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb->data assignment
@ 2012-06-19  7:20 Antonio Quartulli
  2012-06-19  7:41 ` David Miller
  0 siblings, 1 reply; 12+ messages in thread
From: Antonio Quartulli @ 2012-06-19  7:20 UTC (permalink / raw)
  To: stable; +Cc: b.a.t.m.a.n

commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.

skb_linearize(skb) possibly rearranges the skb internal data and then changes
the skb->data pointer value. For this reason any other pointer in the code that
was assigned skb->data before invoking skb_linearise(skb) must be re-assigned.

In the current tt_query message handling code this is not done and therefore, in
case of skb linearization, the pointer used to handle the packet header ends up
in pointing to poisoned memory. The packet is then dropped but the
translation-table mechanism is corrupted.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Cc: <stable@vger.kernel.org> # 3.3
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/routing.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 773e606..7d3ac4e 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -622,6 +622,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
 			 * changes */
 			if (skb_linearize(skb) < 0)
 				goto out;
+			/* skb_linearize() possibly changed skb->data */
+			tt_query = (struct tt_query_packet *)skb->data;
 
 			tt_len = tt_query->tt_data * sizeof(struct tt_change);
 
-- 
1.7.9.4


^ permalink raw reply related	[flat|nested] 12+ messages in thread
* [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb->data assignment
@ 2012-06-19  7:23 Antonio Quartulli
  0 siblings, 0 replies; 12+ messages in thread
From: Antonio Quartulli @ 2012-06-19  7:23 UTC (permalink / raw)
  To: stable; +Cc: b.a.t.m.a.n

commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.

skb_linearize(skb) possibly rearranges the skb internal data and then changes
the skb->data pointer value. For this reason any other pointer in the code that
was assigned skb->data before invoking skb_linearise(skb) must be re-assigned.

In the current tt_query message handling code this is not done and therefore, in
case of skb linearization, the pointer used to handle the packet header ends up
in pointing to poisoned memory. The packet is then dropped but the
translation-table mechanism is corrupted.

Signed-off-by: Antonio Quartulli <ordex@autistici.org>
Cc: <stable@vger.kernel.org> # 3.1
Cc: <stable@vger.kernel.org> # 3.2
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/routing.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/batman-adv/routing.c b/net/batman-adv/routing.c
index 0f32c81..55136e5 100644
--- a/net/batman-adv/routing.c
+++ b/net/batman-adv/routing.c
@@ -1246,6 +1246,8 @@ int recv_tt_query(struct sk_buff *skb, struct hard_iface *recv_if)
 		/* packet needs to be linearised to access the TT changes */
 		if (skb_linearize(skb) < 0)
 			goto out;
+		/* skb_linearize() possibly changed skb->data */
+		tt_query = (struct tt_query_packet *)skb->data;
 
 		if (is_my_mac(tt_query->dst))
 			handle_tt_response(bat_priv, tt_query);
-- 
1.7.9.4


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

end of thread, other threads:[~2012-06-19 12:41 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-06-14 20:21 [B.A.T.M.A.N.] [PATCH] batman-adv: fix skb->data assignment Antonio Quartulli
2012-06-15 11:45 ` Sven Eckelmann
2012-06-15 11:50   ` Antonio Quartulli
2012-06-15 19:09 ` Marek Lindner
  -- strict thread matches above, loose matches on Subject: below --
2012-06-19  7:20 Antonio Quartulli
2012-06-19  7:41 ` David Miller
2012-06-19  8:07   ` Sven Eckelmann
2012-06-19  9:02     ` David Miller
2012-06-19  9:51       ` Sven Eckelmann
2012-06-19 12:10         ` Ben Hutchings
2012-06-19 12:41           ` Sven Eckelmann
2012-06-19  7:23 Antonio Quartulli

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox