serial: etraxfs-uart: Fix crash
PATCH 1/1 serial: etraxfs-uart: Fix crash
Since commit 7d8c70d8048c ("serial: mctrl-gpio: rename init function"), crisv32 either do not build or crash as follows.
Unable to handle kernel NULL pointer dereference Linux 4.3.0-rc7-next-20151101 #1 Sun Nov 1 11:41:28 PST 2015 ... Call Trace: [<c0004a0e>] show_stack+0x0/0x9e [<c004c0c0>] printk+0x0/0x2c [<c00059d4>] show_registers+0x14a/0x1c2 [<c004c0c0>] printk+0x0/0x2c [<c0004b52>] die_if_kernel+0x7c/0x9e [<c0005346>] do_page_fault+0x32e/0x3e6 [<c01dc59c>] of_get_property+0x0/0x2c [<c01e0558>] of_irq_parse_raw+0x12a/0x376 [<c01dc59c>] of_get_property+0x0/0x2c [<c0053aca>] get_page_from_freelist+0x73e/0x856 [<c01dc59c>] of_get_property+0x0/0x2c [<c0008912>] d_mmu_refill+0x10a/0x112 [<c01b488c>] devm_kmalloc+0x40/0x56 [<c01b47d0>] add_dr+0xc/0x1c [<c01b4800>] devm_add_action+0x2/0x4e [<c01abdbc>] mctrl_gpio_init_noauto+0x1c/0x76 [<c01abf9e>] mctrl_gpio_init+0x22/0x110
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit 7b9c5162c182 ("serial:
etraxfs-uart: use mctrl_gpio helpers for handling modem signals").
---
It might make sense to merge this patch into the original patch if possible.
drivers/tty/serial/etraxfs-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/serial/etraxfs-uart.c +1 -1
@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev) up->regi_ser =of_iomap (np,0 ); up->port.dev = &pdev->dev; - up->gpios =mctrl_gpio_init (&pdev->dev,0 ); + up->gpios =mctrl_gpio_init_noauto (&pdev->dev,0 );if (IS_ERR (up->gpios))return PTR_ERR (up->gpios);
Signature · 1 line
2.1.4
Hello,
Quoted 15 lines · Guenter Roeck
Since commit
7d8c70d8048c("serial: mctrl-gpio: rename init function"), crisv32 either do not build or crash as follows.Unable to handle kernel NULL pointer dereference Linux 4.3.0-rc7-next-20151101 #1 Sun Nov 1 11:41:28 PST 2015 ... Call Trace: [<c0004a0e>] show_stack+0x0/0x9e [<c004c0c0>] printk+0x0/0x2c [<c00059d4>] show_registers+0x14a/0x1c2 [<c004c0c0>] printk+0x0/0x2c [<c0004b52>] die_if_kernel+0x7c/0x9e [<c0005346>] do_page_fault+0x32e/0x3e6 [<c01dc59c>] of_get_property+0x0/0x2c [<c01e0558>] of_irq_parse_raw+0x12a/0x376 [<c01dc59c>] of_get_property+0x0/0x2c
Quoted 8 lines
[<c0053aca>] get_page_from_freelist+0x73e/0x856 [<c01dc59c>] of_get_property+0x0/0x2c [<c0008912>] d_mmu_refill+0x10a/0x112 [<c01b488c>] devm_kmalloc+0x40/0x56 [<c01b47d0>] add_dr+0xc/0x1c [<c01b4800>] devm_add_action+0x2/0x4e [<c01abdbc>] mctrl_gpio_init_noauto+0x1c/0x76 [<c01abf9e>] mctrl_gpio_init+0x22/0x110
There should be a warning at compile time about mismatching parameters.
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").
Yes. BTW, 7b9c5162c182 looks broken, too, because the interrupt handling is missing.
Quoted 4 lines
Fixes 7d8c70d8048c ("serial: mctrl-gpio: rename init function")Cc Uwe Kleine-König <[email protected]>Cc Niklas Cassel <[email protected]>Signed-off-by Guenter Roeck <[email protected]>
Thanks
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 27 lines · Uwe Kleine-König
Hello,
Quoted 15 lines · Guenter Roeck
Since commit
7d8c70d8048c("serial: mctrl-gpio: rename init function"), crisv32 either do not build or crash as follows.Unable to handle kernel NULL pointer dereference Linux 4.3.0-rc7-next-20151101 #1 Sun Nov 1 11:41:28 PST 2015 ... Call Trace: [<c0004a0e>] show_stack+0x0/0x9e [<c004c0c0>] printk+0x0/0x2c [<c00059d4>] show_registers+0x14a/0x1c2 [<c004c0c0>] printk+0x0/0x2c [<c0004b52>] die_if_kernel+0x7c/0x9e [<c0005346>] do_page_fault+0x32e/0x3e6 [<c01dc59c>] of_get_property+0x0/0x2c [<c01e0558>] of_irq_parse_raw+0x12a/0x376 [<c01dc59c>] of_get_property+0x0/0x2cQuoted 8 lines
[<c0053aca>] get_page_from_freelist+0x73e/0x856 [<c01dc59c>] of_get_property+0x0/0x2c [<c0008912>] d_mmu_refill+0x10a/0x112 [<c01b488c>] devm_kmalloc+0x40/0x56 [<c01b47d0>] add_dr+0xc/0x1c [<c01b4800>] devm_add_action+0x2/0x4e [<c01abdbc>] mctrl_gpio_init_noauto+0x1c/0x76 [<c01abf9e>] mctrl_gpio_init+0x22/0x110
Quoted 9 lines
There should be a warning at compile time about mismatching parameters.
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.
I can not comment on that; all I can say is that it works for me with qemu.
Guenter
Quoted 34 lines · Guenter Roeck
Quoted 33 lines · Uwe Kleine-König
Hello,
Quoted 15 lines · Guenter Roeck
Since commit
7d8c70d8048c("serial: mctrl-gpio: rename init function"), crisv32 either do not build or crash as follows.Unable to handle kernel NULL pointer dereference Linux 4.3.0-rc7-next-20151101 #1 Sun Nov 1 11:41:28 PST 2015 ... Call Trace: [<c0004a0e>] show_stack+0x0/0x9e [<c004c0c0>] printk+0x0/0x2c [<c00059d4>] show_registers+0x14a/0x1c2 [<c004c0c0>] printk+0x0/0x2c [<c0004b52>] die_if_kernel+0x7c/0x9e [<c0005346>] do_page_fault+0x32e/0x3e6 [<c01dc59c>] of_get_property+0x0/0x2c [<c01e0558>] of_irq_parse_raw+0x12a/0x376 [<c01dc59c>] of_get_property+0x0/0x2cQuoted 8 lines
[<c0053aca>] get_page_from_freelist+0x73e/0x856 [<c01dc59c>] of_get_property+0x0/0x2c [<c0008912>] d_mmu_refill+0x10a/0x112 [<c01b488c>] devm_kmalloc+0x40/0x56 [<c01b47d0>] add_dr+0xc/0x1c [<c01b4800>] devm_add_action+0x2/0x4e [<c01abdbc>] mctrl_gpio_init_noauto+0x1c/0x76 [<c01abf9e>] mctrl_gpio_init+0x22/0x110There should be a warning at compile time about mismatching parameters.
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").
Quoted 5 lines
Quoted 3 lines
Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.I can not comment on that; all I can say is that it works for me with qemu.
What does "works for me" mean? You get output on the qemu console? Fine, but that also works if you don't do any handshaking at all I guess.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.
The only drivers including serial_mctrl_gpio.h is atmel_serial.c, clps711x.c, mxs-auart.c and etraxfs-uart.c
etraxfs commit7b9c5162c182 ("serial: etraxfs-uart: use mctrl_gpio helpers for handling modem signals") is heavily influenced by62b0a1b3e759 ("serial: clps711x: Use mctrl_gpio helpers for handling modem signals")
a driver which also appears to lack mctrl irq setup/handling.
Uwe, are you going to convert all serial drivers that includes serial_mctrl_gpio.h to use the new mctrl_gpio_init? (which also sets up irqs)
Since mctrl gpios are optional in the device tree, I guess mctrl_gpio_init handles if they are missing. So even if etraxfs-uart.c currently lacks mctrl irq setup/handling, if we migrate it to use the new mctrl_gpio_init, we will get this automatically?
Helo Niklas,
Quoted 15 lines · Niklas Cassel
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.The only drivers including
serial_mctrl_gpio.hisatmel_serial.c,clps711x.c,mxs-auart.candetraxfs-uart.cetraxfs commit
7b9c5162c182("serial: etraxfs-uart: usemctrl_gpiohelpers for handling modem signals") is heavily influenced by62b0a1b3e759("serial: clps711x: Usemctrl_gpiohelpers for handling modem signals")
Quoted 5 lines
a driver which also appears to lack mctrl irq setup/handling.
Uwe, are you going to convert all serial drivers that includes
serial_mctrl_gpio.hto use the newmctrl_gpio_init? (which also sets up irqs)
That is the plan. For drivers like mxs-auart (that do irq handling) this is just simplification. When the irq handling is missing converting to the new mctrl_gpio_init might introduce regressions because it does request_irq which might fail.
Quoted 3 lines
Since mctrl gpios are optional in the device tree, I guess
mctrl_gpio_inithandles if they are missing. So even ifetraxfs-uart.ccurrently lacks mctrl irq setup/handling, if we migrate it to use the newmctrl_gpio_init, we will get this automatically?
Right, if there are no gpios specified (new and old) mctrl_gpio is a nop.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-König | Industrial Linux Solutions | http://www.pengutronix.de/ |
I think that Guenter's patch should be merged asap. Right now the bug it fixes stops us from boot testing in qemu.
For the broken mctrl irq handling part, when Uwe has converted mxs-auart to use the generic irq init, I can do the same for etraxfs + make sure that it gets tested properly on real hardware.
Quoted 36 lines · Uwe Kleine-König
Helo Niklas,
Quoted 14 lines · Niklas Cassel
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.The only drivers including
serial_mctrl_gpio.hisatmel_serial.c,clps711x.c,mxs-auart.candetraxfs-uart.cetraxfs commit
7b9c5162c182("serial: etraxfs-uart: usemctrl_gpiohelpers for handling modem signals") is heavily influenced by62b0a1b3e759("serial: clps711x: Usemctrl_gpiohelpers for handling modem signals")Quoted 5 lines
a driver which also appears to lack mctrl irq setup/handling.
Uwe, are you going to convert all serial drivers that includes
serial_mctrl_gpio.hto use the newmctrl_gpio_init? (which also sets up irqs)That is the plan. For drivers like mxs-auart (that do irq handling) this is just simplification. When the irq handling is missing converting to the new
mctrl_gpio_initmight introduce regressions because it doesrequest_irqwhich might fail.Quoted 3 lines
Since mctrl gpios are optional in the device tree, I guess
mctrl_gpio_inithandles if they are missing. So even ifetraxfs-uart.ccurrently lacks mctrl irq setup/handling, if we migrate it to use the newmctrl_gpio_init, we will get this automatically?Right, if there are no gpios specified (new and old)
mctrl_gpiois a nop.Best regards
Uwe
Quoted 3 lines · Niklas Cassel
I think that Guenter's patch should be merged asap. Right now the bug it fixes stops us from boot testing in qemu.
I'll send out a build (failure) report after -rc1 is out. Maybe that will create enough visibility to get the patch accepted (or officially Nacked).
Guenter
Quoted 44 lines
For the broken mctrl irq handling part, when Uwe has converted mxs-auart to use the generic irq init, I can do the same for etraxfs + make sure that it gets tested properly on real hardware.
Quoted 36 lines · Uwe Kleine-König
Helo Niklas,
Quoted 14 lines · Niklas Cassel
Quoted 5 lines · Uwe Kleine-König
Quoted 3 lines
The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Yes. BTW,
7b9c5162c182looks broken, too, because the interrupt handling is missing.The only drivers including
serial_mctrl_gpio.hisatmel_serial.c,clps711x.c,mxs-auart.candetraxfs-uart.cetraxfs commit
7b9c5162c182("serial: etraxfs-uart: usemctrl_gpiohelpers for handling modem signals") is heavily influenced by62b0a1b3e759("serial: clps711x: Usemctrl_gpiohelpers for handling modem signals")Quoted 5 lines
a driver which also appears to lack mctrl irq setup/handling.
Uwe, are you going to convert all serial drivers that includes
serial_mctrl_gpio.hto use the newmctrl_gpio_init? (which also sets up irqs)That is the plan. For drivers like mxs-auart (that do irq handling) this is just simplification. When the irq handling is missing converting to the new
mctrl_gpio_initmight introduce regressions because it doesrequest_irqwhich might fail.Quoted 3 lines
Since mctrl gpios are optional in the device tree, I guess
mctrl_gpio_inithandles if they are missing. So even ifetraxfs-uart.ccurrently lacks mctrl irq setup/handling, if we migrate it to use the newmctrl_gpio_init, we will get this automatically?Right, if there are no gpios specified (new and old)
mctrl_gpiois a nop.Best regards
Uwe
Quoted 51 lines · Guenter Roeck
Since commit
7d8c70d8048c("serial: mctrl-gpio: rename init function"), crisv32 either do not build or crash as follows.Unable to handle kernel NULL pointer dereference Linux 4.3.0-rc7-next-20151101 #1 Sun Nov 1 11:41:28 PST 2015 ... Call Trace: [<c0004a0e>] show_stack+0x0/0x9e [<c004c0c0>] printk+0x0/0x2c [<c00059d4>] show_registers+0x14a/0x1c2 [<c004c0c0>] printk+0x0/0x2c [<c0004b52>] die_if_kernel+0x7c/0x9e [<c0005346>] do_page_fault+0x32e/0x3e6 [<c01dc59c>] of_get_property+0x0/0x2c [<c01e0558>] of_irq_parse_raw+0x12a/0x376 [<c01dc59c>] of_get_property+0x0/0x2c [<c0053aca>] get_page_from_freelist+0x73e/0x856 [<c01dc59c>] of_get_property+0x0/0x2c [<c0008912>] d_mmu_refill+0x10a/0x112 [<c01b488c>] devm_kmalloc+0x40/0x56 [<c01b47d0>] add_dr+0xc/0x1c [<c01b4800>] devm_add_action+0x2/0x4e [<c01abdbc>] mctrl_gpio_init_noauto+0x1c/0x76 [<c01abf9e>] mctrl_gpio_init+0x22/0x110The function call in the etraxfs-uart driver was not renamed, possibly due to interference with commit
7b9c5162c182("serial:
etraxfs-uart: usemctrl_gpiohelpers for handling modem signals").Fixes 7d8c70d8048c ("serial: mctrl-gpio: rename init function")Cc Uwe Kleine-König <[email protected]>Cc Niklas Cassel <[email protected]>Signed-off-by Guenter Roeck <[email protected]>---
It might make sense to merge this patch into the original patch if possible.drivers/tty/serial/etraxfs-uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/tty/serial/etraxfs-uart.c +1
-1@@ -894,7 +894,7 @@ static int etraxfs_uart_probe(struct platform_device *pdev) up->regi_ser =of_iomap (np,0 ); up->port.dev = &pdev->dev; - up->gpios =mctrl_gpio_init (&pdev->dev,0 ); + up->gpios =mctrl_gpio_init_noauto (&pdev->dev,0 );if (IS_ERR (up->gpios))return PTR_ERR (up->gpios);