Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp714803imj; Wed, 13 Feb 2019 16:21:29 -0800 (PST) X-Google-Smtp-Source: AHgI3IZLYpWlOVpV8VG9VdcoS82WswP7ufL6tA9xa9fIWdv2deCY85JcOH3QUyqAASkri26E+KeH X-Received: by 2002:a62:1d0c:: with SMTP id d12mr984634pfd.126.1550103689835; Wed, 13 Feb 2019 16:21:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103689; cv=none; d=google.com; s=arc-20160816; b=wTPaNGcPa2+Km1WOR7cR5MolzP7ayAiRRgnuZayjoEIvMhYX5lb1in3KT6qeFiwhoq jalBmQws5BIVZ1uYjzbJztmzfFinUb9nABSAgpV988EGM0dV8mikR36t7699lXADAuJ5 KGS0D9DAWiQWi2Dhr3ucCzIUbujDyOzNsu7rWf3aKEp+DdXig/dw7ynvmA4+oD5bygUD cnJ0f7WOkbjWyfu3J3Zc98DhBpUUeEYKqovFrnGi3WGDyc3uVgud5lvOu03B98xaqr3x iMv89utAbJhYUCBOJeFkjyk6Vxfo878Br0Abks4N/ySYLMtFEEx+ALFPNv+rCGOa4V3x nNpA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WZIp+GARR/Mnn7Y3RTZSgN3R8hm2+oGoTTjNJCketLs=; b=KzehbKu8FGkQOiZxnyBJJ0EP3DF0qrNnmy3cnqbyJfNIH9W+6Nrlh8l79fNjZfT01m MCOoiINndkmCTE4ZpNY8GdDYjdh/g5DvH0lQjTyzLGhqQKeLRO9VRaXxn+cNfPjRWDDK ZP/HRkjQvhC6Klcg0ENi4kipj7UNozg/2w8mVsc1pkUKnCUVoohFexf7L/6+fyr8RAyk zeiT7f5vutG6wXX49C9Kn2QbJ+cOKuzHPnHPIWLCjSSgDgVMtzmle3U/7nxEmGTKQ3Hj vUu5k5HUEJL6CfhxypCd80FfE510wA4r+qkymrkGb5rWtVD2m0YiGEiiGeyhpGrPeOrq hfCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=wodVE+De; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s17si698388pgi.513.2019.02.13.16.21.14; Wed, 13 Feb 2019 16:21:29 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=wodVE+De; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392079AbfBMSr4 (ORCPT + 99 others); Wed, 13 Feb 2019 13:47:56 -0500 Received: from mail.kernel.org ([198.145.29.99]:45408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406543AbfBMSqw (ORCPT ); Wed, 13 Feb 2019 13:46:52 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 90D12222D1; Wed, 13 Feb 2019 18:46:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083611; bh=hHXCe1RYkn0gikWuM1EYMOXYPvS1x2Ksr2FOiLeZw1Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wodVE+DeE8njh/xUccRNJ6YGUDs6p5wSBiABzP9xLLJzgC453Lo+GwBe2INmH0VOi Ui9wx02mouJ4pWXa25tevpfK4KS1wQwFc2Ml//d4LaCFEM9UEfELKqn1uPMwqTV4A5 c7Z+NRM6GIrJ+JTCSZSJaJrPsx3fI3ZDh8DZj2Vo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+c764de0fcfadca9a8595@syzkaller.appspotmail.com, Dmitry Vyukov , Sven Eckelmann , Simon Wunderlich Subject: [PATCH 4.20 49/50] batman-adv: Avoid WARN on net_device without parent in netns Date: Wed, 13 Feb 2019 19:38:54 +0100 Message-Id: <20190213183659.527325774@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Sven Eckelmann commit 955d3411a17f590364238bd0d3329b61f20c1cd2 upstream. It is not allowed to use WARN* helpers on potential incorrect input from the user or transient problems because systems configured as panic_on_warn will reboot due to such a problem. A NULL return value of __dev_get_by_index can be caused by various problems which can either be related to the system configuration or problems (incorrectly returned network namespaces) in other (virtual) net_device drivers. batman-adv should not cause a (harmful) WARN in this situation and instead only report it via a simple message. Fixes: b7eddd0b3950 ("batman-adv: prevent using any virtual device created on batman-adv as hard-interface") Reported-by: syzbot+c764de0fcfadca9a8595@syzkaller.appspotmail.com Reported-by: Dmitry Vyukov Signed-off-by: Sven Eckelmann Signed-off-by: Simon Wunderlich Signed-off-by: Greg Kroah-Hartman --- net/batman-adv/hard-interface.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -20,7 +20,6 @@ #include "main.h" #include -#include #include #include #include @@ -179,8 +178,10 @@ static bool batadv_is_on_batman_iface(co parent_dev = __dev_get_by_index((struct net *)parent_net, dev_get_iflink(net_dev)); /* if we got a NULL parent_dev there is something broken.. */ - if (WARN(!parent_dev, "Cannot find parent device")) + if (!parent_dev) { + pr_err("Cannot find parent device\n"); return false; + } if (batadv_mutual_parents(net_dev, net, parent_dev, parent_net)) return false;