Skip to content

Commit 2fa2fa1

Browse files
KAGA-KOKOmartinkpetersen
authored andcommitted
scsi: bnx2i: Prevent recursive cpuhotplug locking
The BNX2I module init/exit code installs/removes the hotplug callbacks with the cpu hotplug lock held. This worked with the old CPU locking implementation which allowed recursive locking, but with the new percpu rwsem based mechanism this is not longer allowed. Use the _cpuslocked() variants to fix this. Reported-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Chad Dupuis <chad.dupuis@cavium.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 2c2b66a commit 2fa2fa1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

drivers/scsi/bnx2i/bnx2i_init.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -516,15 +516,16 @@ static int __init bnx2i_mod_init(void)
516516
for_each_online_cpu(cpu)
517517
bnx2i_percpu_thread_create(cpu);
518518

519-
err = cpuhp_setup_state_nocalls(CPUHP_AP_ONLINE_DYN,
520-
"scsi/bnx2i:online",
521-
bnx2i_cpu_online, NULL);
519+
err = cpuhp_setup_state_nocalls_cpuslocked(CPUHP_AP_ONLINE_DYN,
520+
"scsi/bnx2i:online",
521+
bnx2i_cpu_online, NULL);
522522
if (err < 0)
523523
goto remove_threads;
524524
bnx2i_online_state = err;
525525

526-
cpuhp_setup_state_nocalls(CPUHP_SCSI_BNX2I_DEAD, "scsi/bnx2i:dead",
527-
NULL, bnx2i_cpu_dead);
526+
cpuhp_setup_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2I_DEAD,
527+
"scsi/bnx2i:dead",
528+
NULL, bnx2i_cpu_dead);
528529
put_online_cpus();
529530
return 0;
530531

@@ -574,8 +575,8 @@ static void __exit bnx2i_mod_exit(void)
574575
for_each_online_cpu(cpu)
575576
bnx2i_percpu_thread_destroy(cpu);
576577

577-
cpuhp_remove_state_nocalls(bnx2i_online_state);
578-
cpuhp_remove_state_nocalls(CPUHP_SCSI_BNX2I_DEAD);
578+
cpuhp_remove_state_nocalls_cpuslocked(bnx2i_online_state);
579+
cpuhp_remove_state_nocalls_cpuslocked(CPUHP_SCSI_BNX2I_DEAD);
579580
put_online_cpus();
580581

581582
iscsi_unregister_transport(&bnx2i_iscsi_transport);

0 commit comments

Comments
 (0)