From patchwork Wed Aug 17 21:07:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Linus_L=C3=BCssing?= X-Patchwork-Id: 16635 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 5257782DEC; Wed, 17 Aug 2016 23:08:23 +0200 (CEST) Authentication-Results: open-mesh.org; dmarc=none header.from=c0d3.blue Received-SPF: None (no SPF record) identity=mailfrom; client-ip=138.201.29.205; helo=mail.aperture-lab.de; envelope-from=linus.luessing@c0d3.blue; receiver=b.a.t.m.a.n@lists.open-mesh.org Authentication-Results: open-mesh.org; dmarc=none header.from=c0d3.blue Received: from mail.aperture-lab.de (mail.aperture-lab.de [138.201.29.205]) by open-mesh.org (Postfix) with ESMTPS id 6BF5E82DB1 for ; Wed, 17 Aug 2016 23:08:10 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.aperture-lab.de (Postfix) with ESMTP id E3CA5E07B2; Wed, 17 Aug 2016 23:08:09 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at aperture-lab.de Received: from mail.aperture-lab.de ([127.0.0.1]) by localhost (mail.aperture-lab.de [127.0.0.1]) (amavisd-new, port 10025) with ESMTP id LcSU8YDbUoT6; Wed, 17 Aug 2016 23:08:09 +0200 (CEST) Received: from localhost (unknown [IPv6:2001:67c:2d50:0:c85:8cff:fe0f:63fe]) (Authenticated sender: linus.luessing@c0d3.blue) by mail.aperture-lab.de (Postfix) with ESMTPSA; Wed, 17 Aug 2016 23:08:09 +0200 (CEST) From: =?UTF-8?q?Linus=20L=C3=BCssing?= To: b.a.t.m.a.n@lists.open-mesh.org Date: Wed, 17 Aug 2016 23:07:59 +0200 Message-Id: <20160817210759.19357-3-linus.luessing@c0d3.blue> X-Mailer: git-send-email 2.9.3 In-Reply-To: <20160817210759.19357-1-linus.luessing@c0d3.blue> References: <20160817210759.19357-1-linus.luessing@c0d3.blue> MIME-Version: 1.0 Subject: [B.A.T.M.A.N.] [PATCH v2 2/2] batman-adv: fix splat on disabling an interface 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" As long as there is still a reference for a hard interface held, there might still be a forwarding packet relying on its attributes. Therefore avoid setting hard_iface->soft_iface to NULL when disabling a hard interface. This fixes the following, potential splat: ~~~~ [ 3082.208900] batman_adv: bat0: Interface deactivated: eth1 [ 3082.209483] batman_adv: bat0: Removing interface: eth1 [ 3092.087816] cgroup: new mount options do not match the existing superblock, will be ignored [ 3095.774399] batman_adv: bat0: Interface deactivated: eth3 [ 3095.780828] batman_adv: bat0: Removing interface: eth3 [ 3096.344658] ------------[ cut here ]------------ [ 3096.345168] WARNING: CPU: 3 PID: 1986 at ./net/batman-adv/bat_iv_ogm.c:549 batadv_iv_send_outstanding_bat_ogm_packet+0x145/0x643 [batman_adv] [ 3096.348972] Modules linked in: batman_adv(O-) evdev kvm_amd kvm acpi_cpufreq i2c_piix4 tpm_tis tpm irqbypass i2c_core serio_raw processor button bridge stp llc ipv6 autofs4 dm_mirror dm_region_hash dm_log dm_mod 9p fscache 9pnet_virtio 9pnet ata_generic virtio_pci libata virtio_ring virtio scsi_mod e1000 [last unloaded: batman_adv] [ 3096.437029] CPU: 3 PID: 1986 Comm: kworker/u8:2 Tainted: G W O 4.6.0-rc6+ #1 [ 3096.439874] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 3096.452150] Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet [batman_adv] [ 3096.452150] 0000000000000000 ffff88001d93bca0 ffffffff8126c26b 0000000000000000 [ 3096.452150] 0000000000000000 ffff88001d93bcf0 ffffffff81051615 ffff88001f19f818 [ 3096.452150] 000002251d93bd68 0000000000000046 ffff88001dc04a00 ffff88001becbe48 [ 3096.452150] Call Trace: [ 3096.452150] [] dump_stack+0x67/0x90 [ 3096.452150] [] __warn+0xc7/0xe5 [ 3096.452150] [] warn_slowpath_null+0x18/0x1a [ 3096.452150] [] batadv_iv_send_outstanding_bat_ogm_packet+0x145/0x643 [batman_adv] [ 3096.452150] [] ? __lock_is_held+0x32/0x54 [ 3096.452150] [] process_one_work+0x2a8/0x4f5 [ 3096.452150] [] ? process_one_work+0x15c/0x4f5 [ 3096.452150] [] worker_thread+0x1d5/0x2c0 [ 3096.452150] [] ? process_scheduled_works+0x2e/0x2e [ 3096.452150] [] ? process_scheduled_works+0x2e/0x2e [ 3096.452150] [] kthread+0xc0/0xc8 [ 3096.452150] [] ret_from_fork+0x22/0x40 [ 3096.452150] [] ? __init_kthread_worker+0x55/0x55 [ 3096.612402] ---[ end trace 647f9f325123dc05 ]--- ~~~~ What happened here is, that there was still a forw_packet (here: a BATMAN IV OGM) in the queue of eth3 with the forw_packet->if_incoming set to eth1 and the forw_packet->if_outgoing set to eth3. When eth3 is to be deactivated and removed, then this thread waits for the forw_packet queued on eth3 to finish. Because eth1 was deactivated and removed earlier and by that had forw_packet->if_incoming->soft_iface, set to NULL, the splat when trying to send/flush the OGM on eth3 occures. Signed-off-by: Linus Lüssing --- Changes in v2: * none, new patch --- net/batman-adv/hard-interface.c | 1 - 1 file changed, 1 deletion(-) diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c index 08ce361..e034afb 100644 --- a/net/batman-adv/hard-interface.c +++ b/net/batman-adv/hard-interface.c @@ -652,7 +652,6 @@ void batadv_hardif_disable_interface(struct batadv_hard_iface *hard_iface, batadv_softif_destroy_sysfs(hard_iface->soft_iface); } - hard_iface->soft_iface = NULL; batadv_hardif_put(hard_iface); out: