Skip to content

Commit

Permalink
EDAC: Fix workqueue-related crashes
Browse files Browse the repository at this point in the history
00740c5 changed edac_core to
un-/register a workqueue item only if a lowlevel driver supplies a
polling routine. Normally, when we remove a polling low-level driver, we
go and cancel all the queued work. However, the workqueue unreg happens
based on the ->op_state setting, and edac_mc_del_mc() sets this to
OP_OFFLINE _before_ we cancel the work item, leading to NULL ptr oops on
the workqueue list.

Fix it by putting the unreg stuff in proper order.

Cc: <stable@kernel.org> #36.x
Reported-and-tested-by: Tobias Karnat <tobias.karnat@googlemail.com>
LKML-Reference: <1291201307.3029.21.camel@Tobias-Karnat>
Signed-off-by: Borislav Petkov <borislav.petkov@amd.com>
  • Loading branch information
Borislav Petkov committed Dec 8, 2010
1 parent cf7d7e5 commit bb31b31
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions drivers/edac/edac_mc.c
Original file line number Diff line number Diff line change
Expand Up @@ -586,14 +586,16 @@ struct mem_ctl_info *edac_mc_del_mc(struct device *dev)
return NULL;
}

/* marking MCI offline */
mci->op_state = OP_OFFLINE;

del_mc_from_global_list(mci);
mutex_unlock(&mem_ctls_mutex);

/* flush workq processes and remove sysfs */
/* flush workq processes */
edac_mc_workq_teardown(mci);

/* marking MCI offline */
mci->op_state = OP_OFFLINE;

/* remove from sysfs */
edac_remove_sysfs_mci_device(mci);

edac_printk(KERN_INFO, EDAC_MC,
Expand Down

0 comments on commit bb31b31

Please sign in to comment.