[PATCH net v3 1/1] net: phylink: Add module_exit()
Andrew Lunn
andrew at lunn.ch
Thu Jan 11 05:17:10 PST 2024
> Hi Andrew,
>
> Regarding the justification on why it is safe to remove phylink,
> we had done some memory leak check when unloading the phylink module.
>
> root at localhost:~# lsmod | grep "phylink"
> phylink 73728 0
> root at localhost:~# rmmod phylink
> root at localhost:~# echo scan > /sys/kernel/debug/kmemleak
> root at localhost:~# cat /sys/kernel/debug/kmemleak
> root at localhost:~#
>
> So far, we didn't observe any memory leaking happened when unloading
> phylink module. Is it sufficient or do you have any other suggestions to check
> on whether the module is safe to remove?
In general, leaked memory is safe. Being leaked, nothing is using
it. If nothing is using it, how can it cause an opps, corrupt a file
system, etc.
What you need to do is review all users of phylink, and determine if
any of them retains a pointer to anything which phylink manages and
will not be freed or uninitialized when it is unloaded. Is all polling
of GPIOs cleanly stopped? Are interrupt handlers disabled and
removed. Are PCS and MAC drivers cleanly unloaded first? Are hwmon
entries cleanly removed, taking into account that user space might
have them open? All ethtool ioctl/netlink calls are out of the code
before it is removed, etc.
Andrew
More information about the linux-arm-kernel
mailing list