wl12xx: remove redundant debugfs_remove_recursive() call
Upon rmmod, the <debugfs>/ieee80211/phyX dir is being removed. later, we try to remove <debugfs>/ieee80211/phyX/wl12xx, which might result in NULL dereference. Remove the excessive debugfs_remove_recursive() call. (consequently, there is no more need to save wl->rootdir) Reported-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Eliad Peller <eliad@wizery.com> Signed-off-by: Luciano Coelho <luciano.coelho@nokia.com>
This commit is contained in:
committed by
Luciano Coelho
parent
4a4fdf2e0b
commit
3c2c04a15f
@@ -293,12 +293,13 @@ static const struct file_operations gpio_power_ops = {
|
|||||||
.llseek = default_llseek,
|
.llseek = default_llseek,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int wl1271_debugfs_add_files(struct wl1271 *wl)
|
static int wl1271_debugfs_add_files(struct wl1271 *wl,
|
||||||
|
struct dentry *rootdir)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
struct dentry *entry, *stats;
|
struct dentry *entry, *stats;
|
||||||
|
|
||||||
stats = debugfs_create_dir("fw-statistics", wl->rootdir);
|
stats = debugfs_create_dir("fw-statistics", rootdir);
|
||||||
if (!stats || IS_ERR(stats)) {
|
if (!stats || IS_ERR(stats)) {
|
||||||
entry = stats;
|
entry = stats;
|
||||||
goto err;
|
goto err;
|
||||||
@@ -395,13 +396,13 @@ static int wl1271_debugfs_add_files(struct wl1271 *wl)
|
|||||||
DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
|
DEBUGFS_FWSTATS_ADD(rxpipe, missed_beacon_host_int_trig_rx_data);
|
||||||
DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
|
DEBUGFS_FWSTATS_ADD(rxpipe, tx_xfr_host_int_trig_rx_data);
|
||||||
|
|
||||||
DEBUGFS_ADD(tx_queue_len, wl->rootdir);
|
DEBUGFS_ADD(tx_queue_len, rootdir);
|
||||||
DEBUGFS_ADD(retry_count, wl->rootdir);
|
DEBUGFS_ADD(retry_count, rootdir);
|
||||||
DEBUGFS_ADD(excessive_retries, wl->rootdir);
|
DEBUGFS_ADD(excessive_retries, rootdir);
|
||||||
|
|
||||||
DEBUGFS_ADD(gpio_power, wl->rootdir);
|
DEBUGFS_ADD(gpio_power, rootdir);
|
||||||
|
|
||||||
entry = debugfs_create_x32("debug_level", 0600, wl->rootdir,
|
entry = debugfs_create_x32("debug_level", 0600, rootdir,
|
||||||
&wl12xx_debug_level);
|
&wl12xx_debug_level);
|
||||||
if (!entry || IS_ERR(entry))
|
if (!entry || IS_ERR(entry))
|
||||||
goto err;
|
goto err;
|
||||||
@@ -419,7 +420,7 @@ err:
|
|||||||
|
|
||||||
void wl1271_debugfs_reset(struct wl1271 *wl)
|
void wl1271_debugfs_reset(struct wl1271 *wl)
|
||||||
{
|
{
|
||||||
if (!wl->rootdir)
|
if (!wl->stats.fw_stats)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats));
|
memset(wl->stats.fw_stats, 0, sizeof(*wl->stats.fw_stats));
|
||||||
@@ -430,13 +431,13 @@ void wl1271_debugfs_reset(struct wl1271 *wl)
|
|||||||
int wl1271_debugfs_init(struct wl1271 *wl)
|
int wl1271_debugfs_init(struct wl1271 *wl)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
struct dentry *rootdir;
|
||||||
|
|
||||||
wl->rootdir = debugfs_create_dir(KBUILD_MODNAME,
|
rootdir = debugfs_create_dir(KBUILD_MODNAME,
|
||||||
wl->hw->wiphy->debugfsdir);
|
wl->hw->wiphy->debugfsdir);
|
||||||
|
|
||||||
if (IS_ERR(wl->rootdir)) {
|
if (IS_ERR(rootdir)) {
|
||||||
ret = PTR_ERR(wl->rootdir);
|
ret = PTR_ERR(rootdir);
|
||||||
wl->rootdir = NULL;
|
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -450,7 +451,7 @@ int wl1271_debugfs_init(struct wl1271 *wl)
|
|||||||
|
|
||||||
wl->stats.fw_stats_update = jiffies;
|
wl->stats.fw_stats_update = jiffies;
|
||||||
|
|
||||||
ret = wl1271_debugfs_add_files(wl);
|
ret = wl1271_debugfs_add_files(wl, rootdir);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
goto err_file;
|
goto err_file;
|
||||||
@@ -462,8 +463,7 @@ err_file:
|
|||||||
wl->stats.fw_stats = NULL;
|
wl->stats.fw_stats = NULL;
|
||||||
|
|
||||||
err_fw:
|
err_fw:
|
||||||
debugfs_remove_recursive(wl->rootdir);
|
debugfs_remove_recursive(rootdir);
|
||||||
wl->rootdir = NULL;
|
|
||||||
|
|
||||||
err:
|
err:
|
||||||
return ret;
|
return ret;
|
||||||
@@ -473,8 +473,4 @@ void wl1271_debugfs_exit(struct wl1271 *wl)
|
|||||||
{
|
{
|
||||||
kfree(wl->stats.fw_stats);
|
kfree(wl->stats.fw_stats);
|
||||||
wl->stats.fw_stats = NULL;
|
wl->stats.fw_stats = NULL;
|
||||||
|
|
||||||
debugfs_remove_recursive(wl->rootdir);
|
|
||||||
wl->rootdir = NULL;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -378,7 +378,6 @@ struct wl1271 {
|
|||||||
int last_rssi_event;
|
int last_rssi_event;
|
||||||
|
|
||||||
struct wl1271_stats stats;
|
struct wl1271_stats stats;
|
||||||
struct dentry *rootdir;
|
|
||||||
|
|
||||||
__le32 buffer_32;
|
__le32 buffer_32;
|
||||||
u32 buffer_cmd;
|
u32 buffer_cmd;
|
||||||
|
Reference in New Issue
Block a user