-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wifi: eswifi: fix random crash due to work->handler set to NULL #50153
wifi: eswifi: fix random crash due to work->handler set to NULL #50153
Conversation
51360aa
to
4e14e90
Compare
@@ -397,7 +397,7 @@ static int eswifi_off_put(struct net_context *context) | |||
} | |||
|
|||
if (--socket->usage <= 0) { | |||
memset(socket, 0, sizeof(*socket)); | |||
socket->context = NULL; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That certainly works, but wouldn't it be possible to cancel any ongoing/scheduled work instead? I mean once socket is 'released' it's no more assigned to a context, and can be reused at any time, so we don't want anything to access it anymore after this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I'm not sure did I try to do this correctly but I added a static struct k_work_sync work_sync
to the file and called k_work_cancel_delayable_sync(&socket->read_work, &work_sync);
before the memset()
. I tired it a few times but it seems that the execution of the application frozen each time (but there was no crash). The stack showed that I'm in arch_cpu_idle () at /home/mzajac/Repo/Internal/zephyr-root/zephyr/arch/arm/core/aarch32/cpu_idle.S:105
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@loicpoulain Is it fine for you then ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@erwango yes, though it's more a workaround than a fix. but better than nothing.
@mzajac-avs Please check your commit message. It should conform to the following template:
For references, I'd advise you to check:
|
This fixes a random crash caused by race condition in the eswifi driver used by the disco L475 iot1 board. Signed-off-by: Michał Zając <m.zajac@avsystem.com>
4e14e90
to
172b852
Compare
@erwango Fixed the commit message |
@loicpoulain, @nandojve can you approve again? Your approval got lost. |
This fixes the random crash on L475 disco iot1 board described here: #49963