diff options
author | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-08-11 05:51:16 -0400 |
---|---|---|
committer | Stefan Richter <stefanr@s5r6.in-berlin.de> | 2007-08-25 12:00:26 -0400 |
commit | a2ee3f9bbb0ce57102dad8928d54f59acdc4b8f7 (patch) | |
tree | 1eb83e61420815c84f3a61a802e3313267e2c2e1 | |
parent | d1caeb02b17c6bc215a9a40a98a1beb92dcbd310 (diff) |
ieee1394: sbp2: fix sbp2_remove_device for error cases
Bug found by Olaf Hering <olh@suse.de>:
sbp2util_remove_command_orb_pool requires a valid lu->hi pointer.
Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
-rw-r--r-- | drivers/ieee1394/sbp2.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c index 47dbe8f17e82..a81ba8fca0db 100644 --- a/drivers/ieee1394/sbp2.c +++ b/drivers/ieee1394/sbp2.c | |||
@@ -513,9 +513,9 @@ static int sbp2util_create_command_orb_pool(struct sbp2_lu *lu) | |||
513 | return 0; | 513 | return 0; |
514 | } | 514 | } |
515 | 515 | ||
516 | static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu) | 516 | static void sbp2util_remove_command_orb_pool(struct sbp2_lu *lu, |
517 | struct hpsb_host *host) | ||
517 | { | 518 | { |
518 | struct hpsb_host *host = lu->hi->host; | ||
519 | struct list_head *lh, *next; | 519 | struct list_head *lh, *next; |
520 | struct sbp2_command_info *cmd; | 520 | struct sbp2_command_info *cmd; |
521 | unsigned long flags; | 521 | unsigned long flags; |
@@ -922,15 +922,16 @@ static void sbp2_remove_device(struct sbp2_lu *lu) | |||
922 | 922 | ||
923 | if (!lu) | 923 | if (!lu) |
924 | return; | 924 | return; |
925 | |||
926 | hi = lu->hi; | 925 | hi = lu->hi; |
926 | if (!hi) | ||
927 | goto no_hi; | ||
927 | 928 | ||
928 | if (lu->shost) { | 929 | if (lu->shost) { |
929 | scsi_remove_host(lu->shost); | 930 | scsi_remove_host(lu->shost); |
930 | scsi_host_put(lu->shost); | 931 | scsi_host_put(lu->shost); |
931 | } | 932 | } |
932 | flush_scheduled_work(); | 933 | flush_scheduled_work(); |
933 | sbp2util_remove_command_orb_pool(lu); | 934 | sbp2util_remove_command_orb_pool(lu, hi->host); |
934 | 935 | ||
935 | list_del(&lu->lu_list); | 936 | list_del(&lu->lu_list); |
936 | 937 | ||
@@ -971,9 +972,8 @@ static void sbp2_remove_device(struct sbp2_lu *lu) | |||
971 | 972 | ||
972 | lu->ud->device.driver_data = NULL; | 973 | lu->ud->device.driver_data = NULL; |
973 | 974 | ||
974 | if (hi) | 975 | module_put(hi->host->driver->owner); |
975 | module_put(hi->host->driver->owner); | 976 | no_hi: |
976 | |||
977 | kfree(lu); | 977 | kfree(lu); |
978 | } | 978 | } |
979 | 979 | ||