[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220730033335.74153-1-ztong0001@gmail.com>
Date: Fri, 29 Jul 2022 20:33:20 -0700
From: Tong Zhang <ztong0001@...il.com>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Tong Zhang <ztong0001@...il.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Jakub Kicinski <kuba@...nel.org>,
Colin Ian King <colin.king@...el.com>,
Saurav Girepunje <saurav.girepunje@...il.com>,
Nathan Chancellor <nathan@...nel.org>,
Johan Hovold <johan@...nel.org>, linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Cc: Zheyu Ma <zheyuma97@...il.com>
Subject: [PATCH v4 0/4] staging: rtl8192u: fix rmmod warn when device is renamed
There are 4 debug files created under /proc/net/[Devname] by
rtl8192u_usb. Devname could be wlan0 initially, however it could be
renamed later to e.g. enx00e04c000002. This will cause problem during
debug file teardown since it uses netdev->name which is no longer wlan0.
To solve this problem, add a notifier to handle device renaming.
Also, due to this is purely for debuging as files are created read only,
move this to debugfs like other NIC drivers do instead of using procfs.
The directory structure after this patch set will be like the following
/sys/kernel/debug/r8192u_usb/wlan0/stats-rx
/sys/kernel/debug/r8192u_usb/wlan0/stats-rx
/sys/kernel/debug/r8192u_usb/wlan0/stats-ap
/sys/kernel/debug/r8192u_usb/wlan0/registers
Also note that we cannot simply do debugfs_lookup to find out old dentry
since by the time the notifier is called, netdev->name is already changed
to new name. So here we still save the original dentry.
Reported-by: Zheyu Ma <zheyuma97@...il.com>
Tested-by: Zheyu Ma <zheyuma97@...il.com>
Reviewed-by: Dan Carpenter <dan.carpenter@...cle.com>
Signed-off-by: Tong Zhang <ztong0001@...il.com>
v2: break down patch and fix pointer check
v3: removed unnecessary checks, casts and move debug files under module's
own directory, only minor change compared to v2
v4: move cast fix to one commit. use KBUILD_MODNAME for debugfs dir name
Tong Zhang (4):
staging: rtl8192u: move debug stuff to its own file
staging: rtl8192u: remove unnecessary cast
staging: rtl8192u: move debug files to debugfs
staging: rtl8192u: fix rmmod warn when device is renamed
drivers/staging/rtl8192u/Makefile | 1 +
drivers/staging/rtl8192u/r8192U.h | 9 +
drivers/staging/rtl8192u/r8192U_core.c | 226 ++++------------------
drivers/staging/rtl8192u/r8192U_debugfs.c | 188 ++++++++++++++++++
4 files changed, 241 insertions(+), 183 deletions(-)
create mode 100644 drivers/staging/rtl8192u/r8192U_debugfs.c
--
2.25.1
Powered by blists - more mailing lists