1
0
Fork 0

MLK-19864 rpmsg: imx: fix the kernel panic during tty rpmsg demo

Fix the kernel panic during tty rpmsg str echo demo.
Root cause: The driver name may be flushed.
Use the kasprintf to setup the rpmsg tty driver name to
fix this issue.
[   35.494361] Unable to handle kernel paging request at virtual address
ffff000021b4ba40
[   35.502321] Mem abort info:
[   35.505117]   Exception class = DABT (current EL), IL = 32 bits
[   35.511099]   SET = 0, FnV = 0
[   35.514188]   EA = 0, S1PTW = 0
[   35.517328] Data abort info:
[   35.520255]   ISV = 0, ISS = 0x00000007
[   35.524130]   CM = 0, WnR = 0
[   35.527140] swapper pgtable: 4k pages, 48-bit VAs, pgd =
ffff0000096dd000
[   35.533964] [ffff000021b4ba40] *pgd=000000097fffe803,
*pud=000000097fffd803, *pmd=0000000973d20003, *pte=0000000000000000
[   35.544976] Internal error: Oops: 96000007 [#1] PREEMPT SMP
[   35.550553] Modules linked in: imx_rpmsg_tty
[   35.554843] CPU: 2 PID: 3911 Comm: sh Not tainted
4.14.62-05098-gcff652e-dirty #41
[   35.562419] Hardware name: Freescale i.MX8QM MEK (DT)
[   35.567479] task: ffff8008f3950000 task.stack: ffff000021b10000
[   35.573413] PC is at string+0x28/0x98
[   35.577080] LR is at vsnprintf+0x3c0/0x688
[   35.581177] pc : [<ffff000008d5f1a0>] lr : [<ffff000008d61c70>]
pstate: a0000145
[   35.588577] sp : ffff000021b13970
[   35.591894] x29: ffff000021b13970 x28: ffff80097365f56f
[   35.597219] x27: ffff0000092cf03a x26: ffff0000092cf03a
[   35.602544] x25: ffff000021b13a80 x24: ffff8008f365f570
[   35.607869] x23: 00000000ffffffd8 x22: ffff000008fc08dc
[   35.613195] x21: 000000007fffffff x20: ffff000008fc08cc
[   35.618512] x19: ffff8008f365f570 x18: 0000000000000000
[   35.623827] x17: 0000ffffbec93588 x16: ffff00000820b2c0
[   35.629144] x15: 0000000000000000 x14: ffffffffffffffff
[   35.634461] x13: 0000000000000018 x12: 0101010101010101
[   35.639777] x11: 0000000000000000 x10: ffff000021b13a80
[   35.645085] x9 : ffff000021b13a80 x8 : ffff000021b13a80
[   35.650402] x7 : ffff8008f365f570 x6 : fffffffffffffffe
[   35.655718] x5 : 00000000ffffffd0 x4 : ffff000021b4ba40
[   35.661035] x3 : ffff0a00ffffff04 x2 : ffff80097365f56f
[   35.666354] x1 : ffff80097365f56f x0 : ffffffffffffffff
[   35.671672] Process sh (pid: 3911, stack limit = 0xffff000021b10000)
[   35.678022] Call trace:
[   35.680465] Exception stack(0xffff000021b13830 to 0xffff000021b13970)
[   35.686911] 3820:                                   ffffffffffffffff
ffff80097365f56f
[   35.694748] 3840: ffff80097365f56f ffff0a00ffffff04 ffff000021b4ba40
00000000ffffffd0
[   35.702581] 3860: fffffffffffffffe ffff8008f365f570 ffff000021b13a80
ffff000021b13a80
[   35.710409] 3880: ffff000021b13a80 0000000000000000 0101010101010101
0000000000000018
[   35.718245] 38a0: ffffffffffffffff 0000000000000000 ffff00000820b2c0
0000ffffbec93588
[   35.726081] 38c0: 0000000000000000 ffff8008f365f570 ffff000008fc08cc
000000007fffffff
[   35.733908] 38e0: ffff000008fc08dc 00000000ffffffd8 ffff8008f365f570
ffff000021b13a80
[   35.741744] 3900: ffff0000092cf03a ffff0000092cf03a ffff80097365f56f
ffff000021b13970
[   35.749583] 3920: ffff000008d61c70 ffff000021b13970 ffff000008d5f1a0
00000000a0000145
[   35.757417] 3940: ffff8008fff5fb00 0000000000001c00 0000ffffffffffff
ffff000008d61930
[   35.765254] 3960: ffff000021b13970 ffff000008d5f1a0
[   35.770129] [<ffff000008d5f1a0>] string+0x28/0x98
[   35.774837] [<ffff000008d61c70>] vsnprintf+0x3c0/0x688
[   35.779980] [<ffff000008d620e4>] sprintf+0x4c/0x58

Signed-off-by: Richard Zhu <hongxing.zhu@nxp.com>
Reviewed-by: Fugang Duan <fugang.duan@nxp.com>
pull/10/head
Richard Zhu 2018-10-10 14:41:03 +08:00 committed by Jason Liu
parent b2a3a2a635
commit 797008e87e
1 changed files with 2 additions and 3 deletions

View File

@ -140,7 +140,6 @@ static const struct tty_operations imxrpmsgtty_ops = {
static int rpmsg_tty_probe(struct rpmsg_device *rpdev)
{
int ret;
char name[80];
struct rpmsgtty_port *cport;
struct tty_driver *rpmsgtty_driver;
@ -158,8 +157,7 @@ static int rpmsg_tty_probe(struct rpmsg_device *rpdev)
}
rpmsgtty_driver->driver_name = "rpmsg_tty";
sprintf(name, "ttyRPMSG%d", rpdev->dst);
rpmsgtty_driver->name = name;
rpmsgtty_driver->name = kasprintf(GFP_KERNEL, "ttyRPMSG%d", rpdev->dst);
rpmsgtty_driver->major = UNNAMED_MAJOR;
rpmsgtty_driver->minor_start = 0;
rpmsgtty_driver->type = TTY_DRIVER_TYPE_CONSOLE;
@ -214,6 +212,7 @@ static void rpmsg_tty_remove(struct rpmsg_device *rpdev)
dev_info(&rpdev->dev, "rpmsg tty driver is removed\n");
tty_unregister_driver(cport->rpmsgtty_driver);
kfree(cport->rpmsgtty_driver->name);
put_tty_driver(cport->rpmsgtty_driver);
tty_port_destroy(&cport->port);
cport->rpmsgtty_driver = NULL;