Skip to content

Commit 0278ccd

Browse files
bootcStefan Richter
authored andcommitted
firewire: sbp2: fix panic after rmmod with slow targets
If firewire-sbp2 starts a login to a target that doesn't complete ORBs in a timely manner (and has to retry the login), and the module is removed before the operation times out, you end up with a null-pointer dereference and a kernel panic. [SR: This happens because sbp2_target_get/put() do not maintain module references. scsi_device_get/put() do, but at occasions like Chris describes one, nobody holds a reference to an SBP-2 sdev.] This patch cancels pending work for each unit in sbp2_remove(), which hopefully means there are no extra references around that prevent us from unloading. This fixes my crash. Signed-off-by: Chris Boot <bootc@bootc.net> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
1 parent aaff120 commit 0278ccd

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

‎drivers/firewire/sbp2.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,6 +1198,10 @@ static int sbp2_remove(struct device *dev)
11981198
{
11991199
struct fw_unit *unit = fw_unit(dev);
12001200
struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
1201+
struct sbp2_logical_unit *lu;
1202+
1203+
list_for_each_entry(lu, &tgt->lu_list, link)
1204+
cancel_delayed_work_sync(&lu->work);
12011205

12021206
sbp2_target_put(tgt);
12031207
return 0;

0 commit comments

Comments
 (0)