From: Florian Fainelli <f.fainelli@gmail.com>
To: linux-serial@vger.kernel.ogr
Cc: linux-kernel@vger.kernel.org, jslaby@suse.cz,
gregkh@linuxfoundation.org, devicetree@vger.kernel.org,
jingchang.lu@freescale.com, arnd@arndb.de,
gregory.0xf0@gmail.com, Florian Fainelli <f.fainelli@gmail.com>
Subject: [PATCH] serial: of-serial: zero-out struct of_serial_info
Date: Thu, 30 Oct 2014 14:18:33 -0700 [thread overview]
Message-ID: <1414703913-1343-1-git-send-email-f.fainelli@gmail.com> (raw)
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
next reply other threads:[~2014-10-30 21:19 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-30 21:18 Florian Fainelli [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1414703913-1343-1-git-send-email-f.fainelli@gmail.com \
--to=f.fainelli@gmail.com \
--cc=arnd@arndb.de \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=gregory.0xf0@gmail.com \
--cc=jingchang.lu@freescale.com \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.ogr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®