lkml.org 
[lkml]   [2021]   [Jul]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v1 05/12] usb: otg-fsm: Fix hrtimer list corruption
On Thu, Jul 01, 2021 at 05:23:58AM +0300, Dmitry Osipenko wrote:
> The HNP work can be re-scheduled while it's still in-fly. This results in
> re-initialization of the busy work, resetting the hrtimer's list node of
> the work and crashing kernel with null dereference within kernel/timer
> once work's timer is expired. It's very easy to trigger this problem by
> re-plugging USB cable quickly. Initialize HNP work only once to fix this
> trouble.
[...]
> - INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work);
> + if (!fsm->hnp_work_inited) {
> + INIT_DELAYED_WORK(&fsm->hnp_polling_work, otg_hnp_polling_work);
> + fsm->hnp_work_inited = true;
> + }
> +

Maybe you could just add an initialization function to be called by
users of otg_fsm? It seems that only chipidea driver uses this
struct currently.

Best Regards
Michał Mirosław

\
 
 \ /
  Last update: 2021-07-09 00:42    [W:0.173 / U:0.364 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site