* [PATCH] serial: of-serial: zero-out struct of_serial_info
@ 2014-10-30 21:18 Florian Fainelli
2014-10-30 21:55 ` Arnd Bergmann
0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2014-10-30 21:18 UTC (permalink / raw)
To: linux-serial
Cc: linux-kernel, jslaby, gregkh, devicetree, jingchang.lu, arnd,
gregory.0xf0, Florian Fainelli
of_platform_serial_probe() invokes of_platform_serial_setup() with a
kmalloc'd struct of_serial_info cookie, which is not much of a problem
for most of the struct of_serial_info fields we access but info->clk.
On platforms which do not provide a clock phandle for their UART nodes
but do provide a 'clock-frequency' property, we basically leave the
info->clk variable uninitialized, and this craps out during
suspend/resume with oopses, crashes or warnings in the clock code.
Fix this by using kzalloc() which also zeroes-out the structure and
provides an initialized info->clk member set to NULL.
Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Greg, Jiri,
This fixes a regression introduced in 3.18-rc1, thanks!
drivers/tty/serial/of_serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/tty/serial/of_serial.c b/drivers/tty/serial/of_serial.c
index 8bc2563335ae..56982da4a9e9 100644
--- a/drivers/tty/serial/of_serial.c
+++ b/drivers/tty/serial/of_serial.c
@@ -158,7 +158,7 @@ static int of_platform_serial_probe(struct platform_device *ofdev)
if (of_find_property(ofdev->dev.of_node, "used-by-rtas", NULL))
return -EBUSY;
- info = kmalloc(sizeof(*info), GFP_KERNEL);
+ info = kzalloc(sizeof(*info), GFP_KERNEL);
if (info == NULL)
return -ENOMEM;
--
1.9.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] serial: of-serial: zero-out struct of_serial_info
2014-10-30 21:18 [PATCH] serial: of-serial: zero-out struct of_serial_info Florian Fainelli
@ 2014-10-30 21:55 ` Arnd Bergmann
2014-11-04 18:23 ` Florian Fainelli
0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2014-10-30 21:55 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-serial, linux-kernel, jslaby, gregkh, devicetree,
jingchang.lu, gregory.0xf0
On Thursday 30 October 2014 14:18:33 Florian Fainelli wrote:
> of_platform_serial_probe() invokes of_platform_serial_setup() with a
> kmalloc'd struct of_serial_info cookie, which is not much of a problem
> for most of the struct of_serial_info fields we access but info->clk.
>
> On platforms which do not provide a clock phandle for their UART nodes
> but do provide a 'clock-frequency' property, we basically leave the
> info->clk variable uninitialized, and this craps out during
> suspend/resume with oopses, crashes or warnings in the clock code.
>
> Fix this by using kzalloc() which also zeroes-out the structure and
> provides an initialized info->clk member set to NULL.
>
> Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
> Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>
I thought I'd acked this patch before, maybe someone else sent the same
one. This is definitely required, so
Acked-by: Arnd Bergmann <arnd@arndb.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] serial: of-serial: zero-out struct of_serial_info
2014-10-30 21:55 ` Arnd Bergmann
@ 2014-11-04 18:23 ` Florian Fainelli
2014-11-06 18:33 ` Greg KH
0 siblings, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2014-11-04 18:23 UTC (permalink / raw)
To: Arnd Bergmann
Cc: linux-serial, linux-kernel, jslaby, gregkh, devicetree,
jingchang.lu, gregory.0xf0
On 10/30/2014 02:55 PM, Arnd Bergmann wrote:
> On Thursday 30 October 2014 14:18:33 Florian Fainelli wrote:
>> of_platform_serial_probe() invokes of_platform_serial_setup() with a
>> kmalloc'd struct of_serial_info cookie, which is not much of a problem
>> for most of the struct of_serial_info fields we access but info->clk.
>>
>> On platforms which do not provide a clock phandle for their UART nodes
>> but do provide a 'clock-frequency' property, we basically leave the
>> info->clk variable uninitialized, and this craps out during
>> suspend/resume with oopses, crashes or warnings in the clock code.
>>
>> Fix this by using kzalloc() which also zeroes-out the structure and
>> provides an initialized info->clk member set to NULL.
>>
>> Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
>> Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>
>
> I thought I'd acked this patch before, maybe someone else sent the same
> one. This is definitely required, so
>
> Acked-by: Arnd Bergmann <arnd@arndb.de>
>
Thanks, so who's taking that patch? Let me know if I need to resubmit
targeting a specific tree.
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] serial: of-serial: zero-out struct of_serial_info
2014-11-04 18:23 ` Florian Fainelli
@ 2014-11-06 18:33 ` Greg KH
2014-11-06 18:40 ` Florian Fainelli
0 siblings, 1 reply; 5+ messages in thread
From: Greg KH @ 2014-11-06 18:33 UTC (permalink / raw)
To: Florian Fainelli
Cc: Arnd Bergmann, linux-serial, linux-kernel, jslaby, devicetree,
jingchang.lu, gregory.0xf0
On Tue, Nov 04, 2014 at 10:23:49AM -0800, Florian Fainelli wrote:
> On 10/30/2014 02:55 PM, Arnd Bergmann wrote:
> > On Thursday 30 October 2014 14:18:33 Florian Fainelli wrote:
> >> of_platform_serial_probe() invokes of_platform_serial_setup() with a
> >> kmalloc'd struct of_serial_info cookie, which is not much of a problem
> >> for most of the struct of_serial_info fields we access but info->clk.
> >>
> >> On platforms which do not provide a clock phandle for their UART nodes
> >> but do provide a 'clock-frequency' property, we basically leave the
> >> info->clk variable uninitialized, and this craps out during
> >> suspend/resume with oopses, crashes or warnings in the clock code.
> >>
> >> Fix this by using kzalloc() which also zeroes-out the structure and
> >> provides an initialized info->clk member set to NULL.
> >>
> >> Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
> >> Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
> >> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> >>
> >
> > I thought I'd acked this patch before, maybe someone else sent the same
> > one. This is definitely required, so
> >
> > Acked-by: Arnd Bergmann <arnd@arndb.de>
> >
>
> Thanks, so who's taking that patch? Let me know if I need to resubmit
> targeting a specific tree.
Someone else sent this before you did, and I took that version instead,
sorry.
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] serial: of-serial: zero-out struct of_serial_info
2014-11-06 18:33 ` Greg KH
@ 2014-11-06 18:40 ` Florian Fainelli
0 siblings, 0 replies; 5+ messages in thread
From: Florian Fainelli @ 2014-11-06 18:40 UTC (permalink / raw)
To: Greg KH
Cc: Arnd Bergmann, linux-serial, linux-kernel, jslaby, devicetree,
jingchang.lu, gregory.0xf0
On 11/06/2014 10:33 AM, Greg KH wrote:
> On Tue, Nov 04, 2014 at 10:23:49AM -0800, Florian Fainelli wrote:
>> On 10/30/2014 02:55 PM, Arnd Bergmann wrote:
>>> On Thursday 30 October 2014 14:18:33 Florian Fainelli wrote:
>>>> of_platform_serial_probe() invokes of_platform_serial_setup() with a
>>>> kmalloc'd struct of_serial_info cookie, which is not much of a problem
>>>> for most of the struct of_serial_info fields we access but info->clk.
>>>>
>>>> On platforms which do not provide a clock phandle for their UART nodes
>>>> but do provide a 'clock-frequency' property, we basically leave the
>>>> info->clk variable uninitialized, and this craps out during
>>>> suspend/resume with oopses, crashes or warnings in the clock code.
>>>>
>>>> Fix this by using kzalloc() which also zeroes-out the structure and
>>>> provides an initialized info->clk member set to NULL.
>>>>
>>>> Fixes: 2dea53bf57783 ("serial: of-serial: add PM suspend/resume support")
>>>> Fixes: e34b9c94b6e8d ("[POWERPC] of_serial: add port type checking")
>>>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>>>>
>>>
>>> I thought I'd acked this patch before, maybe someone else sent the same
>>> one. This is definitely required, so
>>>
>>> Acked-by: Arnd Bergmann <arnd@arndb.de>
>>>
>>
>> Thanks, so who's taking that patch? Let me know if I need to resubmit
>> targeting a specific tree.
>
> Someone else sent this before you did, and I took that version instead,
> sorry.
Not a problem, my message contained much more explanations, but the end
result is the same.
Thanks!
--
Florian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-06 18:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-30 21:18 [PATCH] serial: of-serial: zero-out struct of_serial_info Florian Fainelli
2014-10-30 21:55 ` Arnd Bergmann
2014-11-04 18:23 ` Florian Fainelli
2014-11-06 18:33 ` Greg KH
2014-11-06 18:40 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).