Skip to content

Commit

Permalink
serial: samsung: protect NULL dereference of clock name
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
KeyYoung Park authored and Greg Kroah-Hartman committed Jun 12, 2012
1 parent 25f04ad commit 7b15e1d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/tty/serial/samsung.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7b15e1d

Please sign in to comment.