diff options
| author | Ashutosh Dixit <ashutosh.dixit@intel.com> | 2015-11-17 18:55:37 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-02-08 01:53:40 -0500 |
| commit | f38e87e8c8d326ec6cddfc3f286b605d996a52a3 (patch) | |
| tree | 53e4b89cefab1d0183f7f380668d8e6862426cd9 /drivers/misc/mic/bus | |
| parent | 3f040887a8be0c28a099a9106bc29443d4f79a7e (diff) | |
misc: mic: Fix crash when MIC reset is invoked in RESET_FAILED state
This patch fixes the following crash seen when MIC reset is invoked in
RESET_FAILED state due to device_del being called a second time on an
already deleted device:
[<ffffffff813b2295>] device_del+0x45/0x1d0
[<ffffffff813b243e>] device_unregister+0x1e/0x60
[<ffffffffa040f1c2>] scif_unregister_device+0x12/0x20 [scif_bus]
[<ffffffffa042f75a>] cosm_stop+0xaa/0xe0 [mic_cosm]
[<ffffffffa042f844>] cosm_reset_trigger_work+0x14/0x20 [mic_cosm]
The fix consists in realizing that because cosm_reset changes the
state to MIC_RESETTING, cosm_stop needs the previous state, before it
changed to MIC_RESETTING, to decide whether a hw_ops->stop had
previously been issued. This is now provided in a new cosm_device
member cdev->prev_state.
Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mic/bus')
| -rw-r--r-- | drivers/misc/mic/bus/cosm_bus.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/misc/mic/bus/cosm_bus.h b/drivers/misc/mic/bus/cosm_bus.h index f7c57f266916..8b6341855dc3 100644 --- a/drivers/misc/mic/bus/cosm_bus.h +++ b/drivers/misc/mic/bus/cosm_bus.h | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | * @attr_group: Pointer to list of sysfs attribute groups. | 30 | * @attr_group: Pointer to list of sysfs attribute groups. |
| 31 | * @sdev: Device for sysfs entries. | 31 | * @sdev: Device for sysfs entries. |
| 32 | * @state: MIC state. | 32 | * @state: MIC state. |
| 33 | * @prev_state: MIC state previous to MIC_RESETTING | ||
| 33 | * @shutdown_status: MIC status reported by card for shutdown/crashes. | 34 | * @shutdown_status: MIC status reported by card for shutdown/crashes. |
| 34 | * @shutdown_status_int: Internal shutdown status maintained by the driver | 35 | * @shutdown_status_int: Internal shutdown status maintained by the driver |
| 35 | * @cosm_mutex: Mutex for synchronizing access to data structures. | 36 | * @cosm_mutex: Mutex for synchronizing access to data structures. |
| @@ -55,6 +56,7 @@ struct cosm_device { | |||
| 55 | const struct attribute_group **attr_group; | 56 | const struct attribute_group **attr_group; |
| 56 | struct device *sdev; | 57 | struct device *sdev; |
| 57 | u8 state; | 58 | u8 state; |
| 59 | u8 prev_state; | ||
| 58 | u8 shutdown_status; | 60 | u8 shutdown_status; |
| 59 | u8 shutdown_status_int; | 61 | u8 shutdown_status_int; |
| 60 | struct mutex cosm_mutex; | 62 | struct mutex cosm_mutex; |
