aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Boot <bootc@bootc.net>2011-08-22 21:38:38 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-25 07:10:16 +0200
commitf92a292abeee48559493433e4e947d0f49fcdd8d (patch)
tree2d893c981d17b627bd5d24e5ba4a72418146bb19
parentc7eead1e118fb7e34ee8f5063c3c090c054c3820 (diff)
downloadkernel_samsung_smdk4412-f92a292abeee48559493433e4e947d0f49fcdd8d.zip
kernel_samsung_smdk4412-f92a292abeee48559493433e4e947d0f49fcdd8d.tar.gz
kernel_samsung_smdk4412-f92a292abeee48559493433e4e947d0f49fcdd8d.tar.bz2
firewire: sbp2: fix panic after rmmod with slow targets
commit 0278ccd9d53e07c4e699432b2fed9de6c56f506c upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/firewire/sbp2.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/firewire/sbp2.c b/drivers/firewire/sbp2.c
index 41841a3..17cef86 100644
--- a/drivers/firewire/sbp2.c
+++ b/drivers/firewire/sbp2.c
@@ -1198,6 +1198,10 @@ static int sbp2_remove(struct device *dev)
{
struct fw_unit *unit = fw_unit(dev);
struct sbp2_target *tgt = dev_get_drvdata(&unit->device);
+ struct sbp2_logical_unit *lu;
+
+ list_for_each_entry(lu, &tgt->lu_list, link)
+ cancel_delayed_work_sync(&lu->work);
sbp2_target_put(tgt);
return 0;