usb: dwc3: imx8mp: request irq after initializing dwc3
authorNadezda Lutovinova <lutovinova@ispras.ru>
Thu, 19 Aug 2021 15:48:18 +0000 (18:48 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 18 Sep 2021 11:42:17 +0000 (13:42 +0200)
commitc20345614cc4b21f3f1b9a98618e6c1f2ac83de0
tree7691f2b176894c07cd96275dabac44af5e61cc19
parentceff0f9a0e8a00c2b86319766c5cf5cd5f46f11a
usb: dwc3: imx8mp: request irq after initializing dwc3

[ Upstream commit 6a48d0ae01a6ab05ae5e78328546a2f5f6d3054a ]

If IRQ occurs between calling  devm_request_threaded_irq() and
initializing dwc3_imx->dwc3, then null pointer dereference occurs
since dwc3_imx->dwc3 is used in dwc3_imx8mp_interrupt().

The patch puts registration of the interrupt handler after
initializing of neccesery data.

Found by Linux Driver Verification project (linuxtesting.org).

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Acked-by: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Nadezda Lutovinova <lutovinova@ispras.ru>
Link: https://lore.kernel.org/r/20210819154818.18334-1-lutovinova@ispras.ru
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/dwc3/dwc3-imx8mp.c