From patchwork Wed Apr 23 19:46:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Lindner X-Patchwork-Id: 4002 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=178.209.62.157; helo=s3.neomailbox.net; envelope-from=mareklindner@neomailbox.ch; receiver=b.a.t.m.a.n@lists.open-mesh.org Received: from s3.neomailbox.net (s3.neomailbox.net [178.209.62.157]) by open-mesh.org (Postfix) with ESMTPS id D8948600AC7 for ; Wed, 23 Apr 2014 21:46:40 +0200 (CEST) From: Marek Lindner To: b.a.t.m.a.n@lists.open-mesh.org Date: Thu, 24 Apr 2014 03:46:30 +0800 Message-Id: <1398282390-4677-1-git-send-email-mareklindner@neomailbox.ch> Cc: Marek Lindner Subject: [B.A.T.M.A.N.] [PATCH maint] batman-adv: fix indirect hard_iface NULL dereference X-BeenThere: b.a.t.m.a.n@lists.open-mesh.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Apr 2014 19:46:41 -0000 If hard_iface is NULL and goto out is made batadv_hardif_free_ref() doesn't check for NULL before dereferencing it to get to refcount. Reported-by: Sven Eckelmann Signed-off-by: Marek Lindner --- originator.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/originator.c b/originator.c index aa2468b..35b42f8 100644 --- a/originator.c +++ b/originator.c @@ -1074,7 +1074,8 @@ int batadv_orig_hardif_seq_print_text(struct seq_file *seq, void *offset) bat_priv->bat_algo_ops->bat_orig_print(bat_priv, seq, hard_iface); out: - batadv_hardif_free_ref(hard_iface); + if (hard_iface) + batadv_hardif_free_ref(hard_iface); return 0; }