Received: by 10.213.65.68 with SMTP id h4csp765280imn; Fri, 23 Mar 2018 15:55:09 -0700 (PDT) X-Google-Smtp-Source: AG47ELssVPwggPfUfMMIB2NF1cni+rhXAMpz6ms5mn4LLQKy2vVqJmMjY52hOg7/os5ZScm9Kvwm X-Received: by 10.99.180.6 with SMTP id s6mr16831794pgf.81.1521845709273; Fri, 23 Mar 2018 15:55:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521845709; cv=none; d=google.com; s=arc-20160816; b=Npm4OrINUW+r7mGXF6pZ+bfWQxdABX9f5AFU7/KH6xsERNL8tsqjz3591qvqI8sY9M IT26g7P9lZlnWKqOXK6FSEbx1Fyvv93Qy46aRRbk+29DMYG4Mnt281uM9pDzy6tQb2/r JBfyz1+Z5r4Sbz17lU1InS1p0XBrKPfgpexHR18Ah7YHzW9vTNDj6zGnwP6MV+Cyrt6L qCcBDc2r1ljInQvIE8IXA+W5xOjqYPI7XATEyOP8alIwJnB3ybAPta9gB0MnO6D3dERh 7MKfktC8VGCAGFUGF/S8itfUYbilFG+kN0/XzeJUhIBoJNvidQQN6J16i520IbRQXFqL bu5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:arc-authentication-results; bh=qNdEwRbsy0YVDKX74ahtgr+/B3PjwWmIDVJYHRmkKTY=; b=Ax6Jsdg6ov5PRx9ds8+jo4g4moIyrqfM9F+AeRttsfp1slpc7qqfOPjTFLxDwdsIUz gBNOCizz7Rb4DB+vSeIo4Nyn/bTuw7TdJu29OcxgIIioL9E6ECcx5rPzt/w75lqwnjNm WdEnQPteK0zQyD7DWqVQ5KIaHrHk6C2eaViyFaD6pN/STR6Aws1JZrC0W2gB5q9NjkGY zlJm3V2X3w3Bd6j6B9cRLW/2MpZ5LfhSPiKV3dtb8HCA2q0n5LK2WuLLai/h82mzTvsi uXg6l8876jSkNAlLBth4ltJzjhaVHtzSxx/YZE0I+jMmp6wI2HKeXux/94kRw4GlfNFx NerQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c11-v6si9095520pls.723.2018.03.23.15.54.53; Fri, 23 Mar 2018 15:55:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752321AbeCWWx7 (ORCPT + 99 others); Fri, 23 Mar 2018 18:53:59 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:45519 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751677AbeCWWx5 (ORCPT ); Fri, 23 Mar 2018 18:53:57 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1ezVZG-0003Xh-Dc; Fri, 23 Mar 2018 22:53:50 +0000 From: Colin King To: Marek Lindner , Simon Wunderlich , Antonio Quartulli , "David S . Miller" , b.a.t.m.a.n@lists.open-mesh.org, netdev@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] batman-adv: don't pass a NULL hard_iface to batadv_hardif_put Date: Fri, 23 Mar 2018 22:53:50 +0000 Message-Id: <20180323225350.7350-1-colin.king@canonical.com> X-Mailer: git-send-email 2.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King In the case where hard_iface is NULL, the error path may pass a null pointer to batadv_hardif_put causing a null pointer dereference error. Avoid this by only calling the function if hard_iface not null. Detected by CoverityScan, CID#1466456 ("Explicit null dereferenced") Fixes: 53dd9a68ba68 ("batman-adv: add multicast flags netlink support") Signed-off-by: Colin Ian King --- net/batman-adv/multicast.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/batman-adv/multicast.c b/net/batman-adv/multicast.c index de3a055f7dd8..bd0ea374d043 100644 --- a/net/batman-adv/multicast.c +++ b/net/batman-adv/multicast.c @@ -1536,7 +1536,7 @@ batadv_mcast_netlink_get_primary(struct netlink_callback *cb, if (!ret && primary_if) *primary_if = hard_iface; - else + else if (hard_iface) batadv_hardif_put(hard_iface); return ret; -- 2.15.1