public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [2.6 patch] drivers/char/watchdog/pcwd_usb.c: fix a NULL pointer dereference
@ 2006-03-10 18:04 Adrian Bunk
  2006-03-12 19:50 ` Wim Van Sebroeck
  0 siblings, 1 reply; 2+ messages in thread
From: Adrian Bunk @ 2006-03-10 18:04 UTC (permalink / raw)
  To: wim; +Cc: linux-kernel

The Coverity checker noted that this resulted in a NULL pointer 
reference if we were coming from

        if (usb_pcwd == NULL) {
                printk(KERN_ERR PFX "Out of memory\n");
                goto error;
        }


Signed-off-by: Adrian Bunk <bunk@stusta.de>

--- linux-2.6.16-rc5-mm3-full/drivers/char/watchdog/pcwd_usb.c.old	2006-03-10 18:18:00.000000000 +0100
+++ linux-2.6.16-rc5-mm3-full/drivers/char/watchdog/pcwd_usb.c	2006-03-10 18:18:45.000000000 +0100
@@ -705,7 +705,8 @@ err_out_misc_deregister:
 err_out_unregister_reboot:
 	unregister_reboot_notifier(&usb_pcwd_notifier);
 error:
-	usb_pcwd_delete (usb_pcwd);
+	if (usb_pcwd)
+		usb_pcwd_delete(usb_pcwd);
 	usb_pcwd_device = NULL;
 	return retval;
 }


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

* Re: [2.6 patch] drivers/char/watchdog/pcwd_usb.c: fix a NULL pointer dereference
  2006-03-10 18:04 [2.6 patch] drivers/char/watchdog/pcwd_usb.c: fix a NULL pointer dereference Adrian Bunk
@ 2006-03-12 19:50 ` Wim Van Sebroeck
  0 siblings, 0 replies; 2+ messages in thread
From: Wim Van Sebroeck @ 2006-03-12 19:50 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel, akpm, mm-commits

Hi Adrian,

> The Coverity checker noted that this resulted in a NULL pointer 
> reference if we were coming from
> 
>         if (usb_pcwd == NULL) {
>                 printk(KERN_ERR PFX "Out of memory\n");
>                 goto error;
>         }
> 
> 
> Signed-off-by: Adrian Bunk <bunk@stusta.de>

This is indeed a bug. I added this patch into my linux-2.6-watchdog-mm tree and I have tested it positively with a PCWD-USB card.

Thanks,
Wim.


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

end of thread, other threads:[~2006-03-12 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-03-10 18:04 [2.6 patch] drivers/char/watchdog/pcwd_usb.c: fix a NULL pointer dereference Adrian Bunk
2006-03-12 19:50 ` Wim Van Sebroeck

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