Message ID | 20230117180343.1451626-1-prestwoj@gmail.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
Series | [1/2] wiphy: prevent multiple wiphy registrations | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
prestwoj/iwd-alpine-ci-fetch | success | Fetch PR |
prestwoj/iwd-ci-gitlint | success | GitLint |
prestwoj/iwd-ci-fetch | success | Fetch PR |
prestwoj/iwd-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-alpine-ci-makedistcheck | success | Make Distcheck |
prestwoj/iwd-ci-build | success | Build - Configure |
prestwoj/iwd-alpine-ci-build | success | Build - Configure |
prestwoj/iwd-ci-clang | success | clang PASS |
prestwoj/iwd-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-ci-makecheck | success | Make Check |
prestwoj/iwd-alpine-ci-makecheckvalgrind | success | Make Check w/Valgrind |
prestwoj/iwd-alpine-ci-makecheck | success | Make Check |
prestwoj/iwd-ci-incremental_build | success | Incremental Build with patches |
prestwoj/iwd-alpine-ci-incremental_build | success | Incremental Build with patches |
prestwoj/iwd-ci-testrunner | success | test-runner PASS |
Hi James, On 1/17/23 12:03, James Prestwood wrote: > With really badly timed events a wiphy can be registered twice. This > happens when IWD starts and requests a wiphy dump. Immediately after > a NEW_WIPHY event comes in (presumably when the driver loads) which > starts another dump. The NEW_WIPHY event can't simply be ignored > since it could be a hotplug (e.g. USB card) so to fix this we can > instead just prevent it from being registered. > > This does mean both dumps will happen but the information will just > be added to the same wiphy object. > --- > src/wiphy.c | 9 +++++++++ > 1 file changed, 9 insertions(+) Both applied, thanks. Regards, -Denis
diff --git a/src/wiphy.c b/src/wiphy.c index 9ca651f4..fcdc3ab8 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -2324,6 +2324,15 @@ static void wiphy_get_reg_domain(struct wiphy *wiphy) void wiphy_create_complete(struct wiphy *wiphy) { + /* + * With really bad timing two wiphy dumps can occur (initial and a + * NEW_WIPHY event) and actually register twice. Ignoring/preventing the + * second dump is problematic since it _could_ be a legitimate event so + * instead just prevent it from registering twice. + */ + if (wiphy->registered) + return; + wiphy_register(wiphy); if (l_memeqzero(wiphy->permanent_addr, 6)) {