From patchwork Sat Jul 2 07:52:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sven Eckelmann X-Patchwork-Id: 16435 X-Patchwork-Delegate: mareklindner@neomailbox.ch Return-Path: X-Original-To: patchwork@open-mesh.org Delivered-To: patchwork@open-mesh.org Received: from open-mesh.org (localhost [IPv6:::1]) by open-mesh.org (Postfix) with ESMTP id 0E7698170E; Sat, 2 Jul 2016 09:52:27 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=narfation.org Authentication-Results: open-mesh.org; dkim=fail reason="verification failed; unprotected key" header.d=narfation.org header.i=@narfation.org header.b=hutbExcP; dkim-adsp=fail (unprotected policy); dkim-atps=neutral Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=79.140.41.39; helo=v3-1039.vlinux.de; envelope-from=sven@narfation.org; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=pass header.from=narfation.org Received: from v3-1039.vlinux.de (narfation.org [79.140.41.39]) by open-mesh.org (Postfix) with ESMTPS id 9D3168057D for ; Sat, 2 Jul 2016 09:52:25 +0200 (CEST) Received: from sven-desktop.home.narfation.org (p200300C593C5E4F90000000000002E16.dip0.t-ipconnect.de [IPv6:2003:c5:93c5:e4f9::2e16]) by v3-1039.vlinux.de (Postfix) with ESMTPSA id 34F431100F1; Sat, 2 Jul 2016 09:52:25 +0200 (CEST) Authentication-Results: v3-1039.vlinux.de; dmarc=none header.from=narfation.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=narfation.org; s=20121; t=1467445945; bh=SZUoBQUNv/LshSHFhwUOiEdsLYVNuqOw3BdxK6wmgtk=; h=From:To:Cc:Subject:Date:From; b=hutbExcPEIKF8lWjBWtKgQu/jcNBfBb9uwYCg2b5OH9J4/Z7E76ur+c6RnVO5tw5/ W1NwulVbOW+BTYQNzum/Pk+gZg7+mmT1IU3by2ACAdKUDp4yqpexzv0P9Xjr0FDbnj MknE/0FzqBtWt+3O99S3fIFZnYADgpCNVyulHkEg= From: Sven Eckelmann To: b.a.t.m.a.n@lists.open-mesh.org Date: Sat, 2 Jul 2016 09:52:13 +0200 Message-Id: <1467445934-13951-1-git-send-email-sven@narfation.org> X-Mailer: git-send-email 2.8.1 Subject: [B.A.T.M.A.N.] [PATCH maint 1/2] batman-adv: Avoid nullptr dereference in bla after vlan_insert_tag X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking Errors-To: b.a.t.m.a.n-bounces@lists.open-mesh.org Sender: "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 --- 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);