1
0
Fork 0
alistair23-linux/net/batman-adv
Linus Lüssing 9799c50372 batman-adv: fix splat on disabling an interface
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:

    batman_adv: bat0: Interface deactivated: eth1
    batman_adv: bat0: Removing interface: eth1
    cgroup: new mount options do not match the existing superblock, will be ignored
    batman_adv: bat0: Interface deactivated: eth3
    batman_adv: bat0: Removing interface: eth3
    ------------[ cut here ]------------
    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]
    Modules linked in: batman_adv(O-) <...>
    CPU: 3 PID: 1986 Comm: kworker/u8:2 Tainted: G        W  O    4.6.0-rc6+ #1
    Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014
    Workqueue: bat_events batadv_iv_send_outstanding_bat_ogm_packet [batman_adv]
     0000000000000000 ffff88001d93bca0 ffffffff8126c26b 0000000000000000
     0000000000000000 ffff88001d93bcf0 ffffffff81051615 ffff88001f19f818
     000002251d93bd68 0000000000000046 ffff88001dc04a00 ffff88001becbe48
    Call Trace:
     [<ffffffff8126c26b>] dump_stack+0x67/0x90
     [<ffffffff81051615>] __warn+0xc7/0xe5
     [<ffffffff8105164b>] warn_slowpath_null+0x18/0x1a
     [<ffffffffa0356f24>] batadv_iv_send_outstanding_bat_ogm_packet+0x145/0x643 [batman_adv]
     [<ffffffff8108b01f>] ? __lock_is_held+0x32/0x54
     [<ffffffff810689a2>] process_one_work+0x2a8/0x4f5
     [<ffffffff81068856>] ? process_one_work+0x15c/0x4f5
     [<ffffffff81068df2>] worker_thread+0x1d5/0x2c0
     [<ffffffff81068c1d>] ? process_scheduled_works+0x2e/0x2e
     [<ffffffff81068c1d>] ? process_scheduled_works+0x2e/0x2e
     [<ffffffff8106dd90>] kthread+0xc0/0xc8
     [<ffffffff8144de82>] ret_from_fork+0x22/0x40
     [<ffffffff8106dcd0>] ? __init_kthread_worker+0x55/0x55
    ---[ 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.

Fixes: c6c8fea297 ("net: Add batman-adv meshing protocol")
Signed-off-by: Linus Lüssing <linus.luessing@c0d3.blue>
[sven@narfation.org: Reduced size of Oops message]
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
2016-10-21 14:47:02 +02:00
..
Kconfig batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
Makefile batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
bat_algo.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
bat_algo.h batman-adv: netlink: add routing_algo query 2016-08-09 07:54:36 +02:00
bat_iv_ogm.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
bat_iv_ogm.h batman-adv: Fix bat_(iv|v) function declaration header 2016-06-30 10:29:43 +02:00
bat_v.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
bat_v.h batman-adv: Fix bat_(iv|v) function declaration header 2016-06-30 10:29:43 +02:00
bat_v_elp.c batman-adv: fix elp packet data reservation 2016-08-26 15:22:31 +02:00
bat_v_elp.h batman-adv: Keep includes ordered by filename 2016-06-30 10:29:43 +02:00
bat_v_ogm.c batman-adv: Place kref_get for orig_node near use 2016-08-09 07:54:46 +02:00
bat_v_ogm.h batman-adv: Include main.h in bat_v_ogm.h 2016-06-30 10:29:43 +02:00
bitarray.c batman-adv: Consolidate logging related functions 2016-06-30 10:29:43 +02:00
bitarray.h batman-adv: Use bool as return type for boolean functions 2016-05-10 18:28:54 +08:00
bridge_loop_avoidance.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
bridge_loop_avoidance.h batman-adv: add backbone table netlink support 2016-08-09 07:54:43 +02:00
debugfs.c batman-adv: Suppress debugfs entries for netns's 2016-08-09 07:54:35 +02:00
debugfs.h treewide: remove redundant #include <linux/kconfig.h> 2016-10-11 15:06:33 -07:00
distributed-arp-table.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
distributed-arp-table.h batman-adv: update copyright years for 2016 2016-02-02 12:55:10 +08:00
fragmentation.c batman-adv: return netdev status in the TX path 2016-07-04 12:37:18 +02:00
fragmentation.h batman-adv: return netdev status in the TX path 2016-07-04 12:37:18 +02:00
gateway_client.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
gateway_client.h batman-adv: netlink: add gateway table queries 2016-08-09 07:54:40 +02:00
gateway_common.c batman-adv: make GW election code protocol specific 2016-08-09 07:54:29 +02:00
gateway_common.h batman-adv: add throughput override attribute to hard_ifaces 2016-02-29 16:05:32 +08:00
hard-interface.c batman-adv: fix splat on disabling an interface 2016-10-21 14:47:02 +02:00
hard-interface.h batman-adv: Create batman soft interfaces within correct netns. 2016-05-10 18:26:44 +08:00
hash.c batman-adv: update copyright years for 2016 2016-02-02 12:55:10 +08:00
hash.h batman-adv: Use bool as return type for boolean functions 2016-05-10 18:28:54 +08:00
icmp_socket.c batman-adv: Consolidate logging related functions 2016-06-30 10:29:43 +02:00
icmp_socket.h batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
log.c batman-adv: Consolidate logging related functions 2016-06-30 10:29:43 +02:00
log.h batman-adv: Add BATADV_DBG_TP_METER to BATADV_DBG_ALL 2016-10-17 16:11:56 +02:00
main.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
main.h batman-adv: Start new development cycle 2016-08-09 07:54:24 +02:00
multicast.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
multicast.h batman-adv: Add debugfs table for mcast flags 2016-06-30 10:29:43 +02:00
netlink.c batman: make netlink attributes const 2016-09-01 14:09:00 -07:00
netlink.h batman-adv: netlink: add translation table query 2016-08-09 07:54:37 +02:00
network-coding.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
network-coding.h batman-adv: update copyright years for 2016 2016-02-02 12:55:10 +08:00
originator.c batman-adv: Modify neigh_list only with rcu-list functions 2016-10-17 16:10:53 +02:00
originator.h batman-adv: netlink: add originator and neighbor table queries 2016-08-09 07:54:38 +02:00
packet.h batman-adv: netlink: add translation table query 2016-08-09 07:54:37 +02:00
routing.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net 2016-09-23 06:46:57 -04:00
routing.h batman-adv: Use bool as return type for boolean functions 2016-05-10 18:28:54 +08:00
send.c batman-adv: Remove orig_node reference handling from send_skb_unicast 2016-08-09 07:54:33 +02:00
send.h batman-adv: Introduce forward packet creation helper 2016-08-09 07:54:32 +02:00
soft-interface.c batman-adv: Place kref_get for softif_vlan near use 2016-08-09 07:54:50 +02:00
soft-interface.h batman-adv: Use bool as return type for boolean functions 2016-05-10 18:28:54 +08:00
sysfs.c batman-adv: disable sysfs knobs when GW-mode is not implemented 2016-08-09 07:54:30 +02:00
sysfs.h batman-adv: update copyright years for 2016 2016-02-02 12:55:10 +08:00
tp_meter.c batman-adv: throughput meter implementation 2016-07-04 12:37:18 +02:00
tp_meter.h batman-adv: throughput meter implementation 2016-07-04 12:37:18 +02:00
translation-table.c batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00
translation-table.h batman-adv: netlink: add translation table query 2016-08-09 07:54:37 +02:00
tvlv.c batman-adv: Place kref_get for tvlv_handler near use 2016-08-09 07:54:53 +02:00
tvlv.h batman-adv: split tvlv into a separate file 2016-06-30 10:29:43 +02:00
types.h batman-adv: Allow to disable debugfs support 2016-08-09 07:54:54 +02:00