Commit d80fc43
wifi: wilc1000: fix RCU usage in connect path
[ Upstream commit 205c503 ]
With lockdep enabled, calls to the connect function from cfg802.11 layer
lead to the following warning:
=============================
WARNING: suspicious RCU usage
6.7.0-rc1-wt+ torvalds#333 Not tainted
-----------------------------
drivers/net/wireless/microchip/wilc1000/hif.c:386
suspicious rcu_dereference_check() usage!
[...]
stack backtrace:
CPU: 0 PID: 100 Comm: wpa_supplicant Not tainted 6.7.0-rc1-wt+ torvalds#333
Hardware name: Atmel SAMA5
unwind_backtrace from show_stack+0x18/0x1c
show_stack from dump_stack_lvl+0x34/0x48
dump_stack_lvl from wilc_parse_join_bss_param+0x7dc/0x7f4
wilc_parse_join_bss_param from connect+0x2c4/0x648
connect from cfg80211_connect+0x30c/0xb74
cfg80211_connect from nl80211_connect+0x860/0xa94
nl80211_connect from genl_rcv_msg+0x3fc/0x59c
genl_rcv_msg from netlink_rcv_skb+0xd0/0x1f8
netlink_rcv_skb from genl_rcv+0x2c/0x3c
genl_rcv from netlink_unicast+0x3b0/0x550
netlink_unicast from netlink_sendmsg+0x368/0x688
netlink_sendmsg from ____sys_sendmsg+0x190/0x430
____sys_sendmsg from ___sys_sendmsg+0x110/0x158
___sys_sendmsg from sys_sendmsg+0xe8/0x150
sys_sendmsg from ret_fast_syscall+0x0/0x1c
This warning is emitted because in the connect path, when trying to parse
target BSS parameters, we dereference a RCU pointer whithout being in RCU
critical section.
Fix RCU dereference usage by moving it to a RCU read critical section. To
avoid wrapping the whole wilc_parse_join_bss_param under the critical
section, just use the critical section to copy ies data
Fixes: c460495 ("staging: wilc1000: fix incorrent type in initializer")
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240105075733.36331-3-alexis.lothore@bootlin.com
Signed-off-by: Sasha Levin <sashal@kernel.org>1 parent 11b5649 commit d80fc43
1 file changed
+24
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
362 | | - | |
363 | | - | |
| 362 | + | |
364 | 363 | | |
365 | 364 | | |
| 365 | + | |
366 | 366 | | |
367 | | - | |
| 367 | + | |
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
373 | 373 | | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
374 | 385 | | |
375 | 386 | | |
376 | 387 | | |
377 | 388 | | |
378 | 389 | | |
379 | 390 | | |
380 | | - | |
| 391 | + | |
381 | 392 | | |
382 | 393 | | |
383 | 394 | | |
384 | 395 | | |
385 | 396 | | |
386 | | - | |
| 397 | + | |
387 | 398 | | |
388 | 399 | | |
389 | 400 | | |
390 | 401 | | |
391 | 402 | | |
392 | 403 | | |
393 | | - | |
| 404 | + | |
394 | 405 | | |
395 | 406 | | |
396 | 407 | | |
| |||
401 | 412 | | |
402 | 413 | | |
403 | 414 | | |
404 | | - | |
| 415 | + | |
405 | 416 | | |
406 | 417 | | |
407 | 418 | | |
| |||
416 | 427 | | |
417 | 428 | | |
418 | 429 | | |
419 | | - | |
| 430 | + | |
420 | 431 | | |
421 | 432 | | |
422 | 433 | | |
423 | | - | |
| 434 | + | |
424 | 435 | | |
425 | 436 | | |
426 | 437 | | |
| |||
444 | 455 | | |
445 | 456 | | |
446 | 457 | | |
447 | | - | |
| 458 | + | |
448 | 459 | | |
449 | 460 | | |
450 | 461 | | |
| |||
459 | 470 | | |
460 | 471 | | |
461 | 472 | | |
462 | | - | |
| 473 | + | |
463 | 474 | | |
464 | 475 | | |
465 | 476 | | |
466 | 477 | | |
467 | 478 | | |
468 | | - | |
| 479 | + | |
469 | 480 | | |
470 | 481 | | |
471 | 482 | | |
| |||
499 | 510 | | |
500 | 511 | | |
501 | 512 | | |
| 513 | + | |
502 | 514 | | |
503 | 515 | | |
504 | 516 | | |
| |||
0 commit comments