From: Greg Kroah-Hartman Date: Mon, 18 Dec 2017 09:39:12 +0000 (+0100) Subject: 4.9-stable patches X-Git-Tag: v3.18.89~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1e8bd70a2003ade9d09e54bfe82aebcad06e40a9;p=thirdparty%2Fkernel%2Fstable-queue.git 4.9-stable patches added patches: mfd-fsl-imx25-clean-up-irq-settings-during-removal.patch --- diff --git a/queue-4.9/mfd-fsl-imx25-clean-up-irq-settings-during-removal.patch b/queue-4.9/mfd-fsl-imx25-clean-up-irq-settings-during-removal.patch new file mode 100644 index 00000000000..239ce3a72a9 --- /dev/null +++ b/queue-4.9/mfd-fsl-imx25-clean-up-irq-settings-during-removal.patch @@ -0,0 +1,67 @@ +From 18f77393796848e68909e65d692c1d1436f06e06 Mon Sep 17 00:00:00 2001 +From: Martin Kaiser +Date: Tue, 17 Oct 2017 22:53:08 +0200 +Subject: mfd: fsl-imx25: Clean up irq settings during removal + +From: Martin Kaiser + +commit 18f77393796848e68909e65d692c1d1436f06e06 upstream. + +When fsl-imx25-tsadc is compiled as a module, loading, unloading and +reloading the module will lead to a crash. + +Unable to handle kernel paging request at virtual address bf005430 +[] (irq_find_matching_fwspec) + from [] (of_irq_get+0x58/0x74) +[] (of_irq_get) + from [] (platform_get_irq+0x48/0xc8) +[] (platform_get_irq) + from [] (mx25_tsadc_probe+0x220/0x2f4 [fsl_imx25_tsadc]) + +irq_find_matching_fwspec() loops over all registered irq domains. The +irq domain is still registered from last time the module was loaded but +the pointer to its operations is invalid after the module was unloaded. + +Add a removal function which clears the irq handler and removes the irq +domain. With this cleanup in place, it's possible to unload and reload +the module. + +Signed-off-by: Martin Kaiser +Reviewed-by: Lucas Stach +Signed-off-by: Lee Jones +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/mfd/fsl-imx25-tsadc.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/mfd/fsl-imx25-tsadc.c ++++ b/drivers/mfd/fsl-imx25-tsadc.c +@@ -183,6 +183,19 @@ static int mx25_tsadc_probe(struct platf + return 0; + } + ++static int mx25_tsadc_remove(struct platform_device *pdev) ++{ ++ struct mx25_tsadc *tsadc = platform_get_drvdata(pdev); ++ int irq = platform_get_irq(pdev, 0); ++ ++ if (irq) { ++ irq_set_chained_handler_and_data(irq, NULL, NULL); ++ irq_domain_remove(tsadc->domain); ++ } ++ ++ return 0; ++} ++ + static const struct of_device_id mx25_tsadc_ids[] = { + { .compatible = "fsl,imx25-tsadc" }, + { /* Sentinel */ } +@@ -194,6 +207,7 @@ static struct platform_driver mx25_tsadc + .of_match_table = of_match_ptr(mx25_tsadc_ids), + }, + .probe = mx25_tsadc_probe, ++ .remove = mx25_tsadc_remove, + }; + module_platform_driver(mx25_tsadc_driver); +