Re: [PATCH] serial: samsung: protect NULL dereference of clock name
On Wed, Jun 20, 2012 at 01:28:47PM +0900, Kukjin Kim wrote: > Kyoungil Kim wrote: > > > > From: KeyYoung Park > > > > When priting the serial clock source, if clock source name is null, > > kernel reference NULL point. > > > > Signed-off-by: KeyYoung Park > > Signed-off-by: Huisung Kang > > Signed-off-by: Kyoungil Kim > > (Cc'ed Greg) > > Acked-by: Kukjin Kim > > Greg, could you please pick this up? Already have, thanks. greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] serial: samsung: protect NULL dereference of clock name
Kyoungil Kim wrote: > > From: KeyYoung Park > > When priting the serial clock source, if clock source name is null, > kernel reference NULL point. > > Signed-off-by: KeyYoung Park > Signed-off-by: Huisung Kang > Signed-off-by: Kyoungil Kim (Cc'ed Greg) Acked-by: Kukjin Kim Greg, could you please pick this up? Thanks. Best regards, Kgene. -- Kukjin Kim , Senior Engineer, SW Solution Development Team, Samsung Electronics Co., Ltd. > --- > drivers/tty/serial/samsung.c |3 ++- > 1 files changed, 2 insertions(+), 1 deletions(-) > > diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c > index ea76b40..77484e0 100644 > --- a/drivers/tty/serial/samsung.c > +++ b/drivers/tty/serial/samsung.c > @@ -1160,7 +1160,8 @@ static ssize_t s3c24xx_serial_show_clksrc(struct > device *dev, > struct uart_port *port = s3c24xx_dev_to_port(dev); > struct s3c24xx_uart_port *ourport = to_ourport(port); > > - 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); > -- > 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH] serial: samsung: protect NULL dereference of clock name
Shubhrajyoti Datta wrote: > Hi Kim, > On Wed, May 30, 2012 at 1:59 PM, Kyoungil Kim wrote: > > From: KeyYoung Park > > > > When priting the serial clock source, if clock source name is null, > > kernel reference NULL point. > > > Could you help me understand why is that NULL ? Or the crash that you saw. When you want to see the serial clock source name like using cat command before you open the tty, You can see the kernel crash. I know this is not normal scenario. This patch just prevents the kernel panic. -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] serial: samsung: protect NULL dereference of clock name
Hi Kim, On Wed, May 30, 2012 at 1:59 PM, Kyoungil Kim wrote: > From: KeyYoung Park > > When priting the serial clock source, if clock source name is null, > kernel reference NULL point. > Could you help me understand why is that NULL ? Or the crash that you saw. -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH] serial: samsung: protect NULL dereference of clock name
From: KeyYoung Park When priting the serial clock source, if clock source name is null, kernel reference NULL point. Signed-off-by: KeyYoung Park Signed-off-by: Huisung Kang Signed-off-by: Kyoungil Kim --- drivers/tty/serial/samsung.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/drivers/tty/serial/samsung.c b/drivers/tty/serial/samsung.c index ea76b40..77484e0 100644 --- a/drivers/tty/serial/samsung.c +++ b/drivers/tty/serial/samsung.c @@ -1160,7 +1160,8 @@ static ssize_t s3c24xx_serial_show_clksrc(struct device *dev, struct uart_port *port = s3c24xx_dev_to_port(dev); struct s3c24xx_uart_port *ourport = to_ourport(port); - 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); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html