serial: samsung: protect NULL dereference of clock name
authorKeyYoung Park <keyyoung.park@samsung.com>
Wed, 30 May 2012 08:29:55 +0000 (17:29 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Jun 2012 22:32:18 +0000 (15:32 -0700)
When priting the serial clock source, if clock source name is null,
kernel reference NULL point.

Signed-off-by: KeyYoung Park <keyyoung.park@samsung.com>
Signed-off-by: Huisung Kang <hs1218.kang@samsung.com>
Signed-off-by: Kyoungil Kim <ki0351.kim@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/samsung.c

index cefdd2d7c58c1e8429fb288e2e3e9984fd11b235..d57f165d6be81fd4e9816a79e545fe5e0f008afc 100644 (file)
@@ -1162,7 +1162,8 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev,
        if (IS_ERR(ourport->baudclk))
                return -EINVAL;
 
-       return snprintf(buf, PAGE_SIZE, "* %s\n", ourport->baudclk->name);
+       return snprintf(buf, PAGE_SIZE, "* %s\n",
+                       ourport->baudclk->name ?: "(null)");
 }
 
 static DEVICE_ATTR(clock_source, S_IRUGO, s3c24xx_serial_show_clksrc, NULL);