b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
@ 2016-07-02  7:52 Sven Eckelmann
  2016-07-02  7:52 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat " Sven Eckelmann
  2016-07-05  8:52 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla " Marek Lindner
  0 siblings, 2 replies; 4+ messages in thread
From: Sven Eckelmann @ 2016-07-02  7:52 UTC (permalink / raw)
  To: b.a.t.m.a.n

vlan_insert_tag can return NULL on errors. The bridge loop avoidance code
therefore has to check the return value of vlan_insert_tag for NULL before
it can safely operate on this pointer.

Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c
index e4f7494..5a41d61 100644
--- a/net/batman-adv/bridge_loop_avoidance.c
+++ b/net/batman-adv/bridge_loop_avoidance.c
@@ -419,9 +419,12 @@ static void batadv_bla_send_claim(struct batadv_priv *bat_priv, u8 *mac,
 		break;
 	}
 
-	if (vid & BATADV_VLAN_HAS_TAG)
+	if (vid & BATADV_VLAN_HAS_TAG) {
 		skb = vlan_insert_tag(skb, htons(ETH_P_8021Q),
 				      vid & VLAN_VID_MASK);
+		if (!skb)
+			goto out;
+	}
 
 	skb_reset_mac_header(skb);
 	skb->protocol = eth_type_trans(skb, soft_iface);
-- 
2.8.1


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

* [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat after vlan_insert_tag
  2016-07-02  7:52 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag Sven Eckelmann
@ 2016-07-02  7:52 ` Sven Eckelmann
  2016-07-05  8:53   ` Marek Lindner
  2016-07-05  8:52 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla " Marek Lindner
  1 sibling, 1 reply; 4+ messages in thread
From: Sven Eckelmann @ 2016-07-02  7:52 UTC (permalink / raw)
  To: b.a.t.m.a.n

vlan_insert_tag can return NULL on errors. The distributed arp table code
therefore has to check the return value of vlan_insert_tag for NULL before
it can safely operate on this pointer.

Fixes: 53c6c262a581 ("batman-adv: tag locally generated ARP reply if needed")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 net/batman-adv/distributed-arp-table.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/net/batman-adv/distributed-arp-table.c b/net/batman-adv/distributed-arp-table.c
index fa76465..b1cc8bf 100644
--- a/net/batman-adv/distributed-arp-table.c
+++ b/net/batman-adv/distributed-arp-table.c
@@ -1011,9 +1011,12 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
 		if (!skb_new)
 			goto out;
 
-		if (vid & BATADV_VLAN_HAS_TAG)
+		if (vid & BATADV_VLAN_HAS_TAG) {
 			skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
 						  vid & VLAN_VID_MASK);
+			if (!skb_new)
+				goto out;
+		}
 
 		skb_reset_mac_header(skb_new);
 		skb_new->protocol = eth_type_trans(skb_new,
@@ -1091,9 +1094,12 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
 	 */
 	skb_reset_mac_header(skb_new);
 
-	if (vid & BATADV_VLAN_HAS_TAG)
+	if (vid & BATADV_VLAN_HAS_TAG) {
 		skb_new = vlan_insert_tag(skb_new, htons(ETH_P_8021Q),
 					  vid & VLAN_VID_MASK);
+		if (!skb_new)
+			goto out;
+	}
 
 	/* To preserve backwards compatibility, the node has choose the outgoing
 	 * format based on the incoming request packet type. The assumption is
-- 
2.8.1


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

* Re: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag
  2016-07-02  7:52 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag Sven Eckelmann
  2016-07-02  7:52 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat " Sven Eckelmann
@ 2016-07-05  8:52 ` Marek Lindner
  1 sibling, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2016-07-05  8:52 UTC (permalink / raw)
  To: b.a.t.m.a.n

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

On Saturday, July 02, 2016 09:52:13 Sven Eckelmann wrote:
> vlan_insert_tag can return NULL on errors. The bridge loop avoidance code
> therefore has to check the return value of vlan_insert_tag for NULL before
> it can safely operate on this pointer.
> 
> Fixes: a9ce0dc43e2c ("batman-adv: add basic bridge loop avoidance code")
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/bridge_loop_avoidance.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)

Applied in revision e4cffba.

Thanks,
Marek

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

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

* Re: [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat after vlan_insert_tag
  2016-07-02  7:52 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat " Sven Eckelmann
@ 2016-07-05  8:53   ` Marek Lindner
  0 siblings, 0 replies; 4+ messages in thread
From: Marek Lindner @ 2016-07-05  8:53 UTC (permalink / raw)
  To: b.a.t.m.a.n

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

On Saturday, July 02, 2016 09:52:14 Sven Eckelmann wrote:
> vlan_insert_tag can return NULL on errors. The distributed arp table code
> therefore has to check the return value of vlan_insert_tag for NULL before
> it can safely operate on this pointer.
> 
> Fixes: 53c6c262a581 ("batman-adv: tag locally generated ARP reply if
> needed") Signed-off-by: Sven Eckelmann <sven@narfation.org>
> ---
>  net/batman-adv/distributed-arp-table.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)

Applied in revision 898382d.

Thanks,
Marek

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

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

end of thread, other threads:[~2016-07-05  8:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-02  7:52 [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag Sven Eckelmann
2016-07-02  7:52 ` [B.A.T.M.A.N.] [PATCH maint 2/2] batman-adv: Avoid nullptr dereference in dat " Sven Eckelmann
2016-07-05  8:53   ` Marek Lindner
2016-07-05  8:52 ` [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla " Marek Lindner

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