netdevsim: fix a several bugs in netdevsim module
Subsystems (2)
v2 cover netdevsim: fix a several bugs in netdevsim module
This patchset fixes several bugs in netdevsim module.
1. The first patch fixes a race condition in basic operation of netdevsim module.
netdevsim operation is called by sysfs and these operations use netdevsim global resource but there is only a lock for protect list, not the whole resource. So, panic occurs.
2. The second patch fixes another race condition.
The main problem is a race condition in {new/del}_port() and devlin reload function.
These functions would allocate and remove resources. So these functions should not be executed concurrently.
3. The third patch fixes stack-out-of-bound in nsim_dev_debugfs_init(). nsim_dev_debugfs_init() provides only 16bytes for name pointer. But, there are some case the name length is over 16bytes. So, stack-out-of-bound occurs.
4. The fourth patch uses IS_ERR instead of IS_ERR_OR_NULL. debugfs_create_{dir/file} doesn't return NULL. So, IS_ERR() is more correct.
5. The fifth patch avoids kmalloc warning.
When too large memory allocation is requested by user-space, kmalloc internally prints warning message.
That warning message is not necessary.
In order to avoid that, it adds __GFP_NOWARN.
6. The last patch removes an unused sdev.c file
Change log:
v1 -> v2:
- Splits a fixing race condition patch into two patches.
- Fix incorrect Fixes tags.
- Update comments
- Fix use-after-free
- Add a new patch, which removes an unused sdev.c file.
- Remove a patch, which tries to avoid debugfs warning.
Taehee Yoo (6):
netdevsim: fix race conditions in netdevsim operations
netdevsim: disable devlink reload when resources are being used
netdevsim: fix stack-out-of-bounds in nsim_dev_debugfs_init()
netdevsim: use IS_ERR instead of IS_ERR_OR_NULL for debugfs
netdevsim: use __GFP_NOWARN to avoid memalloc warning
netdevsim: remove unused sdev code
drivers/net/netdevsim/bpf.c | 10 +++-- drivers/net/netdevsim/bus.c | 56 +++++++++++++++++++++---- drivers/net/netdevsim/dev.c | 32 ++++++++++---- drivers/net/netdevsim/health.c | 6 +-- drivers/net/netdevsim/netdevsim.h | 5 +++ drivers/net/netdevsim/sdev.c | 69 ------------------------------- 6 files changed, 84 insertions(+), 94 deletions(-) delete mode 100644 drivers/net/netdevsim/sdev.c
Signature · 1 line
2.17.1