提交 cc8e4fc0 编写于 作者: M Mathias Nyman 提交者: Greg Kroah-Hartman

xhci: init command timeout timer earlier to avoid deleting it uninitialized

Don't check if timer is running with a timer_pending() before
deleting it with del_timer_sync(), this defies the whole point of
the sync part and can cause a possible race.

Instead we just want to make sure the timer is initialized early enough
before we have a chance to delete it.

Cc: <stable@vger.kernel.org>
Reported-by: NOliver Neukum <oneukum@suse.com>
Signed-off-by: NMathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 dca77945
...@@ -1792,7 +1792,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci) ...@@ -1792,7 +1792,6 @@ void xhci_mem_cleanup(struct xhci_hcd *xhci)
int size; int size;
int i, j, num_ports; int i, j, num_ports;
if (timer_pending(&xhci->cmd_timer))
del_timer_sync(&xhci->cmd_timer); del_timer_sync(&xhci->cmd_timer);
/* Free the Event Ring Segment Table and the actual Event Ring */ /* Free the Event Ring Segment Table and the actual Event Ring */
...@@ -2321,6 +2320,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ...@@ -2321,6 +2320,10 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
INIT_LIST_HEAD(&xhci->cmd_list); INIT_LIST_HEAD(&xhci->cmd_list);
/* init command timeout timer */
setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout,
(unsigned long)xhci);
page_size = readl(&xhci->op_regs->page_size); page_size = readl(&xhci->op_regs->page_size);
xhci_dbg_trace(xhci, trace_xhci_dbg_init, xhci_dbg_trace(xhci, trace_xhci_dbg_init,
"Supported page size register = 0x%x", page_size); "Supported page size register = 0x%x", page_size);
...@@ -2505,10 +2508,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags) ...@@ -2505,10 +2508,6 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
"Wrote ERST address to ir_set 0."); "Wrote ERST address to ir_set 0.");
xhci_print_ir_set(xhci, 0); xhci_print_ir_set(xhci, 0);
/* init command timeout timer */
setup_timer(&xhci->cmd_timer, xhci_handle_command_timeout,
(unsigned long)xhci);
/* /*
* XXX: Might need to set the Interrupter Moderation Register to * XXX: Might need to set the Interrupter Moderation Register to
* something other than the default (~1ms minimum between interrupts). * something other than the default (~1ms minimum between interrupts).
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册