aboutsummaryrefslogtreecommitdiffstats
path: root/net/batman-adv/soft-interface.c
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2011-03-04 16:36:41 -0500
committerMarek Lindner <lindner_marek@yahoo.de>2011-03-05 06:52:09 -0500
commite44d8fe2b5c27ecc230f886d4cc49fcbd86f87a0 (patch)
tree1ed6d2b1fa04a4fe333d8eda498b3e866129d4d3 /net/batman-adv/soft-interface.c
parent7cefb149a6b0e4f7c5adfa27dcf285b729063848 (diff)
batman-adv: Disallow regular interface as mesh device
When trying to associate a net_device with another net_device which already exists, batman-adv assumes that this interface is a fully initialized batman mesh interface without checking it. The behaviour when accessing data behind netdev_priv of a random net_device is undefined and potentially dangerous. Reported-by: Linus Lüssing <linus.luessing@ascom.ch> Signed-off-by: Marek Lindner <lindner_marek@yahoo.de>
Diffstat (limited to 'net/batman-adv/soft-interface.c')
-rw-r--r--net/batman-adv/soft-interface.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c
index 6b514ecee5a2..9ed26140a269 100644
--- a/net/batman-adv/soft-interface.c
+++ b/net/batman-adv/soft-interface.c
@@ -622,6 +622,19 @@ void softif_destroy(struct net_device *soft_iface)
622 unregister_netdevice(soft_iface); 622 unregister_netdevice(soft_iface);
623} 623}
624 624
625int softif_is_valid(struct net_device *net_dev)
626{
627#ifdef HAVE_NET_DEVICE_OPS
628 if (net_dev->netdev_ops->ndo_start_xmit == interface_tx)
629 return 1;
630#else
631 if (net_dev->hard_start_xmit == interface_tx)
632 return 1;
633#endif
634
635 return 0;
636}
637
625/* ethtool */ 638/* ethtool */
626static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd) 639static int bat_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
627{ 640{