Re: [PATCH 3/3] driver core: platform: use bus_type functions

From: Uwe Kleine-König
Date: Sat Dec 12 2020 - 16:15:15 EST


Hi Marek,

On Fri, Dec 11, 2020 at 05:12:16PM +0100, Marek Szyprowski wrote:
> On 19.11.2020 13:46, Uwe Kleine-König wrote:
> > +static void platform_shutdown(struct device *_dev)
> > +{
> > + struct platform_driver *drv = to_platform_driver(_dev->driver);
> > + struct platform_device *dev = to_platform_device(_dev);
> > +
> > + if (drv->shutdown)
> > + drv->shutdown(dev);
> > +}
>
> This will be called on unbound devices, what causes crash (observed on
> today's linux-next):
>
> Will now restart.
> 8<--- cut here ---
> Unable to handle kernel paging request at virtual address fffffff4
> pgd = 289f4b67
> [fffffff4] *pgd=6ffff841, *pte=00000000, *ppte=00000000
> Internal error: Oops: 27 [#1] SMP ARM
> Modules linked in: usb_f_ecm g_ether usb_f_rndis u_ether libcomposite
> brcmfmac sha256_generic libsha256 sha256_arm cfg80211 brcmutil
> panel_samsung_s6e8aa0 s5p_csi
> CPU: 0 PID: 1715 Comm: reboot Not tainted
> 5.10.0-rc7-next-20201211-00069-g1e8aa883315f #9935
> Hardware name: Samsung Exynos (Flattened Device Tree)
> PC is at platform_shutdown+0x8/0x18
> LR is at device_shutdown+0x18c/0x25c
> ...
> Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
> Control: 10c5387d  Table: 4348404a  DAC: 00000051
> Process reboot (pid: 1715, stack limit = 0xd050391e)
> Stack: (0xc3405e60 to 0xc3406000)
> [<c0a38bfc>] (platform_shutdown) from [<c0a34f78>]
> (device_shutdown+0x18c/0x25c)
> [<c0a34f78>] (device_shutdown) from [<c036d3cc>] (kernel_restart+0xc/0x68)
> [<c036d3cc>] (kernel_restart) from [<c036d680>]
> (__do_sys_reboot+0x154/0x1f0)
> [<c036d680>] (__do_sys_reboot) from [<c03000c0>] (ret_fast_syscall+0x0/0x58)
> Exception stack(0xc3405fa8 to 0xc3405ff0)
> ...
> ---[ end trace f39e94d5d6fd45bf ]---

Dmitry Baryshkov already proposed a fix, see
https://lore.kernel.org/r/20201212011426.163071-1-dmitry.baryshkov@xxxxxxxxxx

I expect a v2 soon.

Best regards
Uwe

--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |

Attachment: signature.asc
Description: PGP signature