mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-28 07:04:00 +08:00
36dc621cec
batman-adv is creating special debugfs directories in the init
net_namespace for each valid hard-interface (net_device). But it is
possible to rename a net_device to a completely different name then the
original one.
It can therefore happen that a user registers a new net_device which gets
the name "wlan0" assigned by default. batman-adv is also adding a new
directory under $debugfs/batman-adv/ with the name "wlan0".
The user then decides to rename this device to "wl_pri" and registers a
different device. The kernel may now decide to use the name "wlan0" again
for this new device. batman-adv will detect it as a valid net_device and
tries to create a directory with the name "wlan0" under
$debugfs/batman-adv/. But there already exists one with this name under
this path and thus this fails. batman-adv will detect a problem and
rollback the registering of this device.
batman-adv must therefore take care of renaming the debugfs directories
for hard-interfaces whenever it detects such a net_device rename.
Fixes: 5bc7c1eb44
("batman-adv: add debugfs structure for information per interface")
Reported-by: John Soros <sorosj@gmail.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
/* Copyright (C) 2010-2018 B.A.T.M.A.N. contributors:
|
|
*
|
|
* Marek Lindner
|
|
*
|
|
* This program is free software; you can redistribute it and/or
|
|
* modify it under the terms of version 2 of the GNU General Public
|
|
* License as published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef _NET_BATMAN_ADV_DEBUGFS_H_
|
|
#define _NET_BATMAN_ADV_DEBUGFS_H_
|
|
|
|
#include "main.h"
|
|
|
|
struct net_device;
|
|
|
|
#define BATADV_DEBUGFS_SUBDIR "batman_adv"
|
|
|
|
#if IS_ENABLED(CONFIG_BATMAN_ADV_DEBUGFS)
|
|
|
|
void batadv_debugfs_init(void);
|
|
void batadv_debugfs_destroy(void);
|
|
int batadv_debugfs_add_meshif(struct net_device *dev);
|
|
void batadv_debugfs_del_meshif(struct net_device *dev);
|
|
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface);
|
|
void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface);
|
|
void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface);
|
|
|
|
#else
|
|
|
|
static inline void batadv_debugfs_init(void)
|
|
{
|
|
}
|
|
|
|
static inline void batadv_debugfs_destroy(void)
|
|
{
|
|
}
|
|
|
|
static inline int batadv_debugfs_add_meshif(struct net_device *dev)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline void batadv_debugfs_del_meshif(struct net_device *dev)
|
|
{
|
|
}
|
|
|
|
static inline
|
|
int batadv_debugfs_add_hardif(struct batadv_hard_iface *hard_iface)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
static inline
|
|
void batadv_debugfs_rename_hardif(struct batadv_hard_iface *hard_iface)
|
|
{
|
|
}
|
|
|
|
static inline
|
|
void batadv_debugfs_del_hardif(struct batadv_hard_iface *hard_iface)
|
|
{
|
|
}
|
|
|
|
#endif
|
|
|
|
#endif /* _NET_BATMAN_ADV_DEBUGFS_H_ */
|