linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial: samsung: protect NULL dereference of clock name
@ 2012-05-30  8:29 Kyoungil Kim
  2012-05-30  9:07 ` Shubhrajyoti Datta
  2012-06-20  4:28 ` Kukjin Kim
  0 siblings, 2 replies; 5+ messages in thread
From: Kyoungil Kim @ 2012-05-30  8:29 UTC (permalink / raw)
  To: linux-arm-kernel, linux-samsung-soc, linux-serial
  Cc: 'Kukjin Kim', 'Alan Cox', 'Kyoungil Kim',
	'KeyYoung Park', 'Huisung Kang'

From: KeyYoung Park <keyyoung.park@samsung.com>

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>
---
 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



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: samsung: protect NULL dereference of clock name
  2012-05-30  8:29 [PATCH] serial: samsung: protect NULL dereference of clock name Kyoungil Kim
@ 2012-05-30  9:07 ` Shubhrajyoti Datta
  2012-05-30  9:28   ` Kyoungil Kim
  2012-06-20  4:28 ` Kukjin Kim
  1 sibling, 1 reply; 5+ messages in thread
From: Shubhrajyoti Datta @ 2012-05-30  9:07 UTC (permalink / raw)
  To: Kyoungil Kim
  Cc: linux-arm-kernel, linux-samsung-soc, linux-serial, Kukjin Kim,
	Alan Cox, KeyYoung Park, Huisung Kang

Hi Kim,
On Wed, May 30, 2012 at 1:59 PM, Kyoungil Kim <ki0351.kim@samsung.com> wrote:
> From: KeyYoung Park <keyyoung.park@samsung.com>
>
> 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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] serial: samsung: protect NULL dereference of clock name
  2012-05-30  9:07 ` Shubhrajyoti Datta
@ 2012-05-30  9:28   ` Kyoungil Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Kyoungil Kim @ 2012-05-30  9:28 UTC (permalink / raw)
  To: 'Shubhrajyoti Datta'
  Cc: linux-arm-kernel, linux-samsung-soc, linux-serial,
	'Kukjin Kim', 'Alan Cox', 'KeyYoung Park',
	'Huisung Kang'

Shubhrajyoti Datta wrote:
> Hi Kim,
> On Wed, May 30, 2012 at 1:59 PM, Kyoungil Kim <ki0351.kim@samsung.com> wrote:
> > From: KeyYoung Park <keyyoung.park@samsung.com>
> >
> > 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.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* RE: [PATCH] serial: samsung: protect NULL dereference of clock name
  2012-05-30  8:29 [PATCH] serial: samsung: protect NULL dereference of clock name Kyoungil Kim
  2012-05-30  9:07 ` Shubhrajyoti Datta
@ 2012-06-20  4:28 ` Kukjin Kim
  2012-06-20 23:55   ` Greg KH
  1 sibling, 1 reply; 5+ messages in thread
From: Kukjin Kim @ 2012-06-20  4:28 UTC (permalink / raw)
  To: 'Kyoungil Kim', linux-arm-kernel, linux-samsung-soc,
	linux-serial
  Cc: 'Alan Cox', 'KeyYoung Park',
	'Huisung Kang', gregkh

Kyoungil Kim wrote:
> 
> From: KeyYoung Park <keyyoung.park@samsung.com>
> 
> 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>

(Cc'ed Greg)

Acked-by: Kukjin Kim <kgene.kim@samsung.com>

Greg, could you please pick this up?

Thanks.

Best regards,
Kgene.
--
Kukjin Kim <kgene.kim@samsung.com>, 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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] serial: samsung: protect NULL dereference of clock name
  2012-06-20  4:28 ` Kukjin Kim
@ 2012-06-20 23:55   ` Greg KH
  0 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2012-06-20 23:55 UTC (permalink / raw)
  To: Kukjin Kim
  Cc: 'Kyoungil Kim', linux-arm-kernel, linux-samsung-soc,
	linux-serial, 'Alan Cox', 'KeyYoung Park',
	'Huisung Kang'

On Wed, Jun 20, 2012 at 01:28:47PM +0900, Kukjin Kim wrote:
> Kyoungil Kim wrote:
> > 
> > From: KeyYoung Park <keyyoung.park@samsung.com>
> > 
> > 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>
> 
> (Cc'ed Greg)
> 
> Acked-by: Kukjin Kim <kgene.kim@samsung.com>
> 
> Greg, could you please pick this up?

Already have, thanks.

greg k-h

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-20 23:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-30  8:29 [PATCH] serial: samsung: protect NULL dereference of clock name Kyoungil Kim
2012-05-30  9:07 ` Shubhrajyoti Datta
2012-05-30  9:28   ` Kyoungil Kim
2012-06-20  4:28 ` Kukjin Kim
2012-06-20 23:55   ` Greg KH

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).