diff mbox

mmc: hsmmc: Fix NULL pointer dereference on unload when booted with device tree

Message ID 20121109182534.GR6801@atomide.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tony Lindgren Nov. 9, 2012, 6:25 p.m. UTC
When booting with device tree, we don't have any pdata, and will
get the following when trying to unload omap_hsmmc:

Unable to handle kernel NULL pointer dereference at virtual address 00000044
pgd = edafc000
*pgd=adbbd831, *pte=00000000, *ppte=00000000
SMP ARM
Modules linked in: omap_hsmmc(-) omap_serial pinctrl_single
CPU: 1    Not tainted  (3.7.0-rc4-00044-g8ca5f6a-dirty #245)
PC is at omap_hsmmc_gpio_free+0x8/0x3c [omap_hsmmc]
LR is at omap_hsmmc_remove+0xf0/0x174 [omap_hsmmc]
   psr: 60000113
sp : ee887ef0  ip : 00000040  fp : be83cc14
r10: 00000000  r9 : ee886000  r8 : c0014348
r7 : ee886000  r6 : eea1d010  r5 : eea1d000  r4 : 00000000
r3 : 00000000  r2 : 00000000  r1 : 00000000  r0 : 00000000
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: adafc04a  DAC: 00000015
Process rmmod (pid: 1758, stack limit = 0xee886240)
Stack: (0xee887ef0 to 0xee888000)
7ee0:                                     edbe1400 bf01250c eea1d018 eea1d010
7f00: bf0138ac c0331c64 ee886000 c0330528 eea1d010 bf0138ac eea1d044 c033063c
7f20: 00000000 bf0138ac c079f250 c032f618 00000000 00000880 bf013980 c00a42d0
7f40: c02ce9b4 70616d6f 6d73685f 0000636d c04ef560 c0014348 ee886000 ee886000
7f60: eeb21600 00000001 c00142a0 60000110 00000000 ef000000 be83cc14 00095f40
7f80: bf013980 00000880 ee887f8c 00000000 00000081 be83cba8 00000000 00000000
7fa0: 00000081 c00141a0 be83cba8 00000000 be83cba8 00000880 00000880 be83cba8
7fc0: be83cba8 00000000 00000000 00000081 00000000 00000000 b6f42000 be83cc14
7fe0: 00000000 be83cba0 000091cc b6eb48bc 60000110 be83cba8 aaaaaaaa aabaaaaa
(omap_hsmmc_remove+0xf0/0x174 [omap_hsmmc])
(platform_drv_remove+0x1c/0x24)
(__device_release_driver+0x90/0xf0)
(driver_detach+0xb4/0xb8)
(bus_remove_driver+0x88/0xdc)
(sys_delete_module+0x144/0x220)
(ret_fast_syscall+0x0/0x3c)
Code: eaffffbe c073a1f0 e92d4010 e1a04000 (e5900044)

Signed-off-by: Tony Lindgren <tony@atomide.com>

---

This is against v3.7-rc4, would be nice to get in during the -rc cycle.

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Balaji T K Nov. 12, 2012, 1:20 p.m. UTC | #1
On Friday 09 November 2012 11:55 PM, Tony Lindgren wrote:
> When booting with device tree, we don't have any pdata, and will
> get the following when trying to unload omap_hsmmc:
>
> Unable to handle kernel NULL pointer dereference at virtual address 00000044
> pgd = edafc000
> *pgd=adbbd831, *pte=00000000, *ppte=00000000
> SMP ARM
> Modules linked in: omap_hsmmc(-) omap_serial pinctrl_single
> CPU: 1    Not tainted  (3.7.0-rc4-00044-g8ca5f6a-dirty #245)
> PC is at omap_hsmmc_gpio_free+0x8/0x3c [omap_hsmmc]
> LR is at omap_hsmmc_remove+0xf0/0x174 [omap_hsmmc]
<snip>
>
> Signed-off-by: Tony Lindgren <tony@atomide.com>
>
> ---
>
> This is against v3.7-rc4, would be nice to get in during the -rc cycle.
>
Hi Tony,

Got fixed by below commit, merged in rc5

http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commit;h=9ea28ecbeb090159a3383ff60b29dee00c489774

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Tony Lindgren Nov. 12, 2012, 10:16 p.m. UTC | #2
* Balaji T K <balajitk@ti.com> [121112 05:22]:
> On Friday 09 November 2012 11:55 PM, Tony Lindgren wrote:
> >When booting with device tree, we don't have any pdata, and will
> >get the following when trying to unload omap_hsmmc:
> >
> >Unable to handle kernel NULL pointer dereference at virtual address 00000044
> >pgd = edafc000
> >*pgd=adbbd831, *pte=00000000, *ppte=00000000
> >SMP ARM
> >Modules linked in: omap_hsmmc(-) omap_serial pinctrl_single
> >CPU: 1    Not tainted  (3.7.0-rc4-00044-g8ca5f6a-dirty #245)
> >PC is at omap_hsmmc_gpio_free+0x8/0x3c [omap_hsmmc]
> >LR is at omap_hsmmc_remove+0xf0/0x174 [omap_hsmmc]
> <snip>
> >
> >Signed-off-by: Tony Lindgren <tony@atomide.com>
> >
> >---
> >
> >This is against v3.7-rc4, would be nice to get in during the -rc cycle.
> >
> Hi Tony,
> 
> Got fixed by below commit, merged in rc5
> 
> http://git.kernel.org/?p=linux/kernel/git/cjb/mmc.git;a=commit;h=9ea28ecbeb090159a3383ff60b29dee00c489774

OK thanks!

Tony 
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/drivers/mmc/host/omap_hsmmc.c
+++ b/drivers/mmc/host/omap_hsmmc.c
@@ -377,6 +377,9 @@  static int omap_hsmmc_gpio_init(struct omap_mmc_platform_data *pdata)
 {
 	int ret;
 
+	if (!pdata)
+		return 0;
+
 	if (gpio_is_valid(pdata->slots[0].switch_pin)) {
 		if (pdata->slots[0].cover)
 			pdata->slots[0].get_cover_state =
@@ -418,6 +421,9 @@  err_free_sp:
 
 static void omap_hsmmc_gpio_free(struct omap_mmc_platform_data *pdata)
 {
+	if (!pdata)
+		return;
+
 	if (gpio_is_valid(pdata->slots[0].gpio_wp))
 		gpio_free(pdata->slots[0].gpio_wp);
 	if (gpio_is_valid(pdata->slots[0].switch_pin))