public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions
@ 2014-01-20 10:06 Linus Lüssing
  2014-01-20 15:07 ` Antonio Quartulli
  0 siblings, 1 reply; 3+ messages in thread
From: Linus Lüssing @ 2014-01-20 10:06 UTC (permalink / raw)
  To: b.a.t.m.a.n

batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
data. If it does then our ethhdr pointer is not valid anymore in
batadv_send_skb_unicast(), resulting in a kernel paging error.

Fixing this by refetching the ethhdr pointer after the potential
reallocation.

Introduced by b46c60b9e1ee7a1909c542413a85875a750955d6
("batman-adv: improve unicast packet (re)routing")

Signed-off-by: Linus Lüssing <linus.luessing@web.de>
---
Changes v4:
* "s/Introduced-by:/Introduced by/" to make checkpatch happy

 send.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/send.c b/send.c
index b0a3d76..50df184 100644
--- a/send.c
+++ b/send.c
@@ -281,6 +281,10 @@ static int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
 		goto out;
 	}
 
+	/* skb->data might have been reallocated by
+	 * batadv_send_skb_prepare_unicast*
+	 */
+	ethhdr = eth_hdr(skb);
 	unicast_packet = (struct batadv_unicast_packet *)skb->data;
 
 	/* inform the destination node that we are still missing a correct route
-- 
1.7.10.4


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

* Re: [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions
  2014-01-20 10:06 [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions Linus Lüssing
@ 2014-01-20 15:07 ` Antonio Quartulli
  2014-01-27  7:45   ` Marek Lindner
  0 siblings, 1 reply; 3+ messages in thread
From: Antonio Quartulli @ 2014-01-20 15:07 UTC (permalink / raw)
  To: The list for a Better Approach To Mobile Ad-hoc Networking

[-- Attachment #1: Type: text/plain, Size: 1246 bytes --]

On 20/01/14 11:06, Linus Lüssing wrote:
> batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
> data. If it does then our ethhdr pointer is not valid anymore in
> batadv_send_skb_unicast(), resulting in a kernel paging error.
> 
> Fixing this by refetching the ethhdr pointer after the potential
> reallocation.
> 
> Introduced by b46c60b9e1ee7a1909c542413a85875a750955d6
> ("batman-adv: improve unicast packet (re)routing")
> 
> Signed-off-by: Linus Lüssing <linus.luessing@web.de>

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

> ---
> Changes v4:
> * "s/Introduced-by:/Introduced by/" to make checkpatch happy
> 
>  send.c |    4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/send.c b/send.c
> index b0a3d76..50df184 100644
> --- a/send.c
> +++ b/send.c
> @@ -281,6 +281,10 @@ static int batadv_send_skb_unicast(struct batadv_priv *bat_priv,
>  		goto out;
>  	}
>  
> +	/* skb->data might have been reallocated by
> +	 * batadv_send_skb_prepare_unicast*
> +	 */
> +	ethhdr = eth_hdr(skb);
>  	unicast_packet = (struct batadv_unicast_packet *)skb->data;
>  
>  	/* inform the destination node that we are still missing a correct route
> 


-- 
Antonio Quartulli


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions
  2014-01-20 15:07 ` Antonio Quartulli
@ 2014-01-27  7:45   ` Marek Lindner
  0 siblings, 0 replies; 3+ messages in thread
From: Marek Lindner @ 2014-01-27  7:45 UTC (permalink / raw)
  To: b.a.t.m.a.n; +Cc: Antonio Quartulli

[-- Attachment #1: Type: text/plain, Size: 735 bytes --]

On Monday 20 January 2014 16:07:53 Antonio Quartulli wrote:
> On 20/01/14 11:06, Linus Lüssing wrote:
> > batadv_send_skb_prepare_unicast(_4addr) might reallocate the skb's
> > data. If it does then our ethhdr pointer is not valid anymore in
> > batadv_send_skb_unicast(), resulting in a kernel paging error.
> >
> > 
> >
> > Fixing this by refetching the ethhdr pointer after the potential
> > reallocation.
> >
> > 
> >
> > Introduced by b46c60b9e1ee7a1909c542413a85875a750955d6
> > ("batman-adv: improve unicast packet (re)routing")
> >
> > 
> >
> > Signed-off-by: Linus Lüssing <linus.luessing@web.de>
> 
> Acked-by: Antonio Quartulli <antonio@meshcoding.com>

Applied in revision 41b3872.

Thanks,
Marek

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

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

end of thread, other threads:[~2014-01-27  7:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-20 10:06 [B.A.T.M.A.N.] [PATCHv4 maint] batman-adv: fix potential kernel paging error for unicast transmissions Linus Lüssing
2014-01-20 15:07 ` Antonio Quartulli
2014-01-27  7:45   ` Marek Lindner

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