From: Ming Lei Date: Tue, 4 Jan 2011 12:21:32 +0000 (+0800) Subject: usb: otg: nop: fix oops triggered by otg_register_notifier X-Git-Tag: v2.6.38-rc3~7^2~21 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=20831ad23978d0543b0b23128621b6d8ee7757f1;p=linux.git usb: otg: nop: fix oops triggered by otg_register_notifier This patch adds BLOCKING_INIT_NOTIFIER_HEAD in nop_usb_xceiv_probe, so that we can avoid oops caused by uninitialized nop->otg.notifier.rwsem which will be touched in otg_register_notifier path. Reported-by: Gupta, Ajay Kumar Tested-by: Gupta, Ajay Kumar Cc: Balbi, Felipe Cc: David Brownell Signed-off-by: Ming Lei Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/otg/nop-usb-xceiv.c b/drivers/usb/otg/nop-usb-xceiv.c index e70014ab0976..8acf165fe13b 100644 --- a/drivers/usb/otg/nop-usb-xceiv.c +++ b/drivers/usb/otg/nop-usb-xceiv.c @@ -132,6 +132,8 @@ static int __devinit nop_usb_xceiv_probe(struct platform_device *pdev) platform_set_drvdata(pdev, nop); + BLOCKING_INIT_NOTIFIER_HEAD(&nop->otg.notifier); + return 0; exit: kfree(nop);