Commit b680928
wifi: wilc1000: fix RCU usage in connect path
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>1 parent 3d693f3 commit b680928
1 file changed
+23
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
377 | 377 | | |
378 | 378 | | |
379 | 379 | | |
380 | | - | |
381 | | - | |
| 380 | + | |
382 | 381 | | |
383 | 382 | | |
| 383 | + | |
384 | 384 | | |
385 | | - | |
| 385 | + | |
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
392 | 402 | | |
393 | 403 | | |
394 | 404 | | |
395 | 405 | | |
396 | 406 | | |
397 | 407 | | |
398 | | - | |
| 408 | + | |
399 | 409 | | |
400 | 410 | | |
401 | 411 | | |
402 | 412 | | |
403 | 413 | | |
404 | | - | |
| 414 | + | |
405 | 415 | | |
406 | 416 | | |
407 | 417 | | |
408 | 418 | | |
409 | 419 | | |
410 | 420 | | |
411 | | - | |
| 421 | + | |
412 | 422 | | |
413 | 423 | | |
414 | 424 | | |
| |||
419 | 429 | | |
420 | 430 | | |
421 | 431 | | |
422 | | - | |
| 432 | + | |
423 | 433 | | |
424 | 434 | | |
425 | 435 | | |
| |||
434 | 444 | | |
435 | 445 | | |
436 | 446 | | |
437 | | - | |
| 447 | + | |
438 | 448 | | |
439 | 449 | | |
440 | 450 | | |
441 | | - | |
| 451 | + | |
442 | 452 | | |
443 | 453 | | |
444 | 454 | | |
| |||
462 | 472 | | |
463 | 473 | | |
464 | 474 | | |
465 | | - | |
| 475 | + | |
466 | 476 | | |
467 | 477 | | |
468 | 478 | | |
| |||
477 | 487 | | |
478 | 488 | | |
479 | 489 | | |
480 | | - | |
| 490 | + | |
481 | 491 | | |
482 | 492 | | |
483 | 493 | | |
484 | 494 | | |
485 | 495 | | |
486 | | - | |
| 496 | + | |
487 | 497 | | |
488 | 498 | | |
489 | 499 | | |
| |||
517 | 527 | | |
518 | 528 | | |
519 | 529 | | |
| 530 | + | |
520 | 531 | | |
521 | 532 | | |
522 | 533 | | |
| |||
0 commit comments