From: Tony LIU Date: Fri, 20 Jul 2012 02:11:06 +0000 (+0800) Subject: ENGR00217717 mfgtool firmware will crash during mfgtool running X-Git-Url: https://git.karo-electronics.de/?p=karo-tx-linux.git;a=commitdiff_plain;h=fd61546e4be3836284933f730dfa5845055fdc6d ENGR00217717 mfgtool firmware will crash during mfgtool running - the root cause of this issue is there is no protection for the resource which will be accessed by multiple thread Signed-off-by: Tony LIU --- diff --git a/drivers/usb/gadget/function/fsl_updater.c b/drivers/usb/gadget/function/fsl_updater.c index 8b4af624ba83..72c14ba03ace 100644 --- a/drivers/usb/gadget/function/fsl_updater.c +++ b/drivers/usb/gadget/function/fsl_updater.c @@ -70,9 +70,11 @@ static u32 count_list(struct list_head *l) u32 count = 0; struct list_head *tmp; + mutex_lock(&utp_context.lock); list_for_each(tmp, l) { count++; } + mutex_unlock(&utp_context.lock); return count; }