public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: fix possible use-before-NULL-check crash
@ 2010-10-06 22:39 Kees Cook
  2010-10-06 22:51 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Kees Cook @ 2010-10-06 22:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: devel, Greg Kroah-Hartman, Mauro Carvalho Chehab, Stefan Ringel,
	Stephen Rothwell

Found via http://coccinelle.lip6.fr/rules/mini_null_ref.cocci

Signed-off-by: Kees Cook <kees.cook@canonical.com>
---
 drivers/staging/tm6000/tm6000-alsa.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
index 087137d..c1aff0e 100644
--- a/drivers/staging/tm6000/tm6000-alsa.c
+++ b/drivers/staging/tm6000/tm6000-alsa.c
@@ -426,10 +426,11 @@ error:
 
 static int tm6000_audio_fini(struct tm6000_core *dev)
 {
-	struct snd_tm6000_card	*chip = dev->adev;
+	struct snd_tm6000_card	*chip;
 
 	if (!dev)
 		return 0;
+	chip = dev->adev;
 
 	if (!chip)
 		return 0;
-- 
1.7.1


-- 
Kees Cook
Ubuntu Security Team

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

* Re: [PATCH] staging: fix possible use-before-NULL-check crash
  2010-10-06 22:39 [PATCH] staging: fix possible use-before-NULL-check crash Kees Cook
@ 2010-10-06 22:51 ` Greg KH
  2010-10-07  0:12   ` Kees Cook
  0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2010-10-06 22:51 UTC (permalink / raw)
  To: Kees Cook
  Cc: linux-kernel, devel, Mauro Carvalho Chehab, Stefan Ringel,
	Stephen Rothwell

On Wed, Oct 06, 2010 at 03:39:41PM -0700, Kees Cook wrote:
> Found via http://coccinelle.lip6.fr/rules/mini_null_ref.cocci
> 
> Signed-off-by: Kees Cook <kees.cook@canonical.com>
> ---
>  drivers/staging/tm6000/tm6000-alsa.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/staging/tm6000/tm6000-alsa.c b/drivers/staging/tm6000/tm6000-alsa.c
> index 087137d..c1aff0e 100644
> --- a/drivers/staging/tm6000/tm6000-alsa.c
> +++ b/drivers/staging/tm6000/tm6000-alsa.c
> @@ -426,10 +426,11 @@ error:
>  
>  static int tm6000_audio_fini(struct tm6000_core *dev)
>  {
> -	struct snd_tm6000_card	*chip = dev->adev;
> +	struct snd_tm6000_card	*chip;
>  
>  	if (!dev)
>  		return 0;
> +	chip = dev->adev;

Nice catch, but I don't think that the dev pointer can ever be NULL
here.

Mauro, can you queue this up through your tree, as you handle this one?

thanks,

greg k-h

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

* Re: [PATCH] staging: fix possible use-before-NULL-check crash
  2010-10-06 22:51 ` Greg KH
@ 2010-10-07  0:12   ` Kees Cook
  0 siblings, 0 replies; 3+ messages in thread
From: Kees Cook @ 2010-10-07  0:12 UTC (permalink / raw)
  To: Greg KH
  Cc: linux-kernel, devel, Mauro Carvalho Chehab, Stefan Ringel,
	Stephen Rothwell

Hi Greg,

On Wed, Oct 06, 2010 at 03:51:04PM -0700, Greg KH wrote:
> Nice catch, but I don't think that the dev pointer can ever be NULL
> here.

Yeah, I didn't think so either, but figured it was best to fix it anyway.

-Kees

-- 
Kees Cook
Ubuntu Security Team

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

end of thread, other threads:[~2010-10-07  0:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-06 22:39 [PATCH] staging: fix possible use-before-NULL-check crash Kees Cook
2010-10-06 22:51 ` Greg KH
2010-10-07  0:12   ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox