staging: rtl8192u: fix rmmod warn when device is renamed
authorTong Zhang <ztong0001@gmail.com>
Sat, 30 Jul 2022 03:33:24 +0000 (20:33 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 16 Aug 2022 13:13:27 +0000 (15:13 +0200)
commit7b84ab85b12648bc27016088776bbd075e022be3
treec0eea5790331fd2bb5f5619a4bd93c0b387f8ecc
parentc5682c05b26215592faa97deeec896454179169b
staging: rtl8192u: fix rmmod warn when device is renamed

This driver creates 4 debug files under [devname] folder. The devname
could be wlan0 initially, however it could be renamed later to e.g.
enx00e04c00000. 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 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.

Reported-by: Zheyu Ma <zheyuma97@gmail.com>
Tested-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Link: https://lore.kernel.org/r/20220730033335.74153-5-ztong0001@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8192u/r8192U.h
drivers/staging/rtl8192u/r8192U_core.c
drivers/staging/rtl8192u/r8192U_debugfs.c