All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null
@ 2009-02-06  8:27 Bryan Wu
  2009-02-06 10:06 ` Alan Cox
  2009-02-07  0:05 ` Andrew Morton
  0 siblings, 2 replies; 4+ messages in thread
From: Bryan Wu @ 2009-02-06  8:27 UTC (permalink / raw)
  To: alan; +Cc: linux-kernel, Sonic Zhang, Bryan Wu

From: Sonic Zhang <sonic.zhang@analog.com>

when pass bootargs console=null into kernel from u-boot, the booted up
kernel can't be pinged through. This happens after the kernel is upgraded
to 2.6.28.

Should check if tty_driver is NULL before call kref_get() in tty_driver_kref_get().

Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
---
 include/linux/tty_driver.h |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
index 08e0883..2a602a8 100644
--- a/include/linux/tty_driver.h
+++ b/include/linux/tty_driver.h
@@ -312,7 +312,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
 extern void tty_driver_kref_put(struct tty_driver *driver);
 extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
 {
-	kref_get(&d->kref);
+	if (d)
+		kref_get(&d->kref);
 	return d;
 }
 
-- 
1.5.6.3

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

* Re: [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null
  2009-02-06  8:27 [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null Bryan Wu
@ 2009-02-06 10:06 ` Alan Cox
  2009-02-07  0:05 ` Andrew Morton
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2009-02-06 10:06 UTC (permalink / raw)
  To: Bryan Wu; +Cc: linux-kernel, Sonic Zhang, Bryan Wu

On Fri,  6 Feb 2009 16:27:57 +0800
Bryan Wu <cooloney@kernel.org> wrote:

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> when pass bootargs console=null into kernel from u-boot, the booted up
> kernel can't be pinged through. This happens after the kernel is upgraded
> to 2.6.28.
> 
> Should check if tty_driver is NULL before call kref_get() in tty_driver_kref_get().

Should not call tty_driver_kref_get(NULL) in the first place....

Need to fix the real bug not paper over it

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

* Re: [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null
  2009-02-06  8:27 [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null Bryan Wu
  2009-02-06 10:06 ` Alan Cox
@ 2009-02-07  0:05 ` Andrew Morton
  2009-02-07  0:09   ` Alan Cox
  1 sibling, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2009-02-07  0:05 UTC (permalink / raw)
  To: Bryan Wu; +Cc: alan, linux-kernel, sonic.zhang, cooloney

On Fri,  6 Feb 2009 16:27:57 +0800
Bryan Wu <cooloney@kernel.org> wrote:

> From: Sonic Zhang <sonic.zhang@analog.com>
> 
> when pass bootargs console=null into kernel from u-boot, the booted up
> kernel can't be pinged through. This happens after the kernel is upgraded
> to 2.6.28.
> 
> Should check if tty_driver is NULL before call kref_get() in tty_driver_kref_get().
> 
> Signed-off-by: Sonic Zhang <sonic.zhang@analog.com>
> Signed-off-by: Bryan Wu <cooloney@kernel.org>
> ---
>  include/linux/tty_driver.h |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/include/linux/tty_driver.h b/include/linux/tty_driver.h
> index 08e0883..2a602a8 100644
> --- a/include/linux/tty_driver.h
> +++ b/include/linux/tty_driver.h
> @@ -312,7 +312,8 @@ extern struct tty_driver *tty_find_polling_driver(char *name, int *line);
>  extern void tty_driver_kref_put(struct tty_driver *driver);
>  extern inline struct tty_driver *tty_driver_kref_get(struct tty_driver *d)
>  {
> -	kref_get(&d->kref);
> +	if (d)
> +		kref_get(&d->kref);
>  	return d;
>  }
>  

Did any earlier kernel versions handle this situation OK?

If so, we might need to be back-compatible with buggy userspace :(

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

* Re: [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null
  2009-02-07  0:05 ` Andrew Morton
@ 2009-02-07  0:09   ` Alan Cox
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2009-02-07  0:09 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Bryan Wu, linux-kernel, sonic.zhang

> Did any earlier kernel versions handle this situation OK?
> 
> If so, we might need to be back-compatible with buggy userspace :(

Nothing to do with userspace. You can't call tty_driver_kref_get(NULL),
it's completely bogus.

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

end of thread, other threads:[~2009-02-07  0:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-06  8:27 [PATCH] tty: fix bug - kernel can't be pinged through when bootargs console=null Bryan Wu
2009-02-06 10:06 ` Alan Cox
2009-02-07  0:05 ` Andrew Morton
2009-02-07  0:09   ` Alan Cox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.