Skip to content

Commit 19d82bd

Browse files
committed
wifi: iwlwifi: mvm: handle debugfs names more carefully
With debugfs=off, we can get here with the dbgfs_dir being an ERR_PTR(). Instead of checking for all this, which is often flagged as a mistake, simply handle the names here more carefully by printing them, then we don't need extra checks. Also, while checking, I noticed theoretically 'buf' is too small, so fix that size as well. Cc: [email protected] Closes: https://bugzilla.kernel.org/show_bug.cgi?id=218422 Fixes: c36235a ("wifi: iwlwifi: mvm: rework debugfs handling") Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://msgid.link/20240320232419.4dc1eb3dd015.I32f308b0356ef5bcf8d188dd98ce9b210e3ab9fd@changeid Signed-off-by: Johannes Berg <[email protected]>
1 parent 17f6451 commit 19d82bd

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/wireless/intel/iwlwifi/mvm/debugfs-vif.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -748,7 +748,9 @@ void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
748748
{
749749
struct dentry *dbgfs_dir = vif->debugfs_dir;
750750
struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
751-
char buf[100];
751+
char buf[3 * 3 + 11 + (NL80211_WIPHY_NAME_MAXLEN + 1) +
752+
(7 + IFNAMSIZ + 1) + 6 + 1];
753+
char name[7 + IFNAMSIZ + 1];
752754

753755
/* this will happen in monitor mode */
754756
if (!dbgfs_dir)
@@ -761,10 +763,11 @@ void iwl_mvm_vif_dbgfs_add_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
761763
* find
762764
* netdev:wlan0 -> ../../../ieee80211/phy0/netdev:wlan0/iwlmvm/
763765
*/
764-
snprintf(buf, 100, "../../../%pd3/iwlmvm", dbgfs_dir);
766+
snprintf(name, sizeof(name), "%pd", dbgfs_dir);
767+
snprintf(buf, sizeof(buf), "../../../%pd3/iwlmvm", dbgfs_dir);
765768

766-
mvmvif->dbgfs_slink = debugfs_create_symlink(dbgfs_dir->d_name.name,
767-
mvm->debugfs_dir, buf);
769+
mvmvif->dbgfs_slink =
770+
debugfs_create_symlink(name, mvm->debugfs_dir, buf);
768771
}
769772

770773
void iwl_mvm_vif_dbgfs_rm_link(struct iwl_mvm *mvm, struct ieee80211_vif *vif)

0 commit comments

Comments
 (0)