public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.13] Unhandled error condition in aic79xx
@ 2005-09-01 19:38 Daniel Walker
  2005-09-01 19:59 ` Jiri Slaby
  2005-09-01 20:10 ` Alexey Dobriyan
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Walker @ 2005-09-01 19:38 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel

This patch should handle the case when scsi_add_host() fails.

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c
===================================================================
--- linux-2.6.13.orig/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-08-28 23:41:01.000000000 +0000
+++ linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-08-31 18:49:09.000000000 +0000
@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softc
 	char	*new_name;
 	u_long	s;
 	u_long	target;
+	int error = 0;
 
 	template->name = ahd->description;
 	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
@@ -2065,7 +2066,11 @@ ahd_linux_register_host(struct ahd_softc
 	ahd_unlock(ahd, &s);
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
+	error = scsi_add_host(host, &ahd->dev_softc->dev); 
+	if (error) {
+		scsi_host_put(host);
+		return(error);
+	}
 	scsi_scan_host(host);
 #endif
 	return (0);



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

* Re: [PATCH 2.6.13] Unhandled error condition in aic79xx
  2005-09-01 19:38 [PATCH 2.6.13] Unhandled error condition in aic79xx Daniel Walker
@ 2005-09-01 19:59 ` Jiri Slaby
  2005-09-01 20:10 ` Alexey Dobriyan
  1 sibling, 0 replies; 5+ messages in thread
From: Jiri Slaby @ 2005-09-01 19:59 UTC (permalink / raw)
  To: dwalker; +Cc: akpm, linux-kernel

Daniel Walker napsal(a):

>This patch should handle the case when scsi_add_host() fails.
>
>Signed-Off-By: Daniel Walker <dwalker@mvista.com>
>
>Index: linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c
>===================================================================
>--- linux-2.6.13.orig/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-08-28 23:41:01.000000000 +0000
>+++ linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-08-31 18:49:09.000000000 +0000
>@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softc
> 	char	*new_name;
> 	u_long	s;
> 	u_long	target;
>+	int error = 0;
> 
> 	template->name = ahd->description;
> 	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
>@@ -2065,7 +2066,11 @@ ahd_linux_register_host(struct ahd_softc
> 	ahd_unlock(ahd, &s);
> 
> #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
>  
>
Maybe this could go away.

>-	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
>+	error = scsi_add_host(host, &ahd->dev_softc->dev); 
>+	if (error) {
>+		scsi_host_put(host);
>+		return(error);
>  
>
no ( ) around return value, please

>+	}
> 	scsi_scan_host(host);
> #endif
> 	return (0);
>  
>
regards,

-- 
Jiri Slaby         www.fi.muni.cz/~xslaby
~\-/~      jirislaby@gmail.com      ~\-/~
241B347EC88228DE51EE A49C4A73A25004CB2A10


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

* Re: [PATCH 2.6.13] Unhandled error condition in aic79xx
  2005-09-01 19:38 [PATCH 2.6.13] Unhandled error condition in aic79xx Daniel Walker
  2005-09-01 19:59 ` Jiri Slaby
@ 2005-09-01 20:10 ` Alexey Dobriyan
  2005-09-01 20:19   ` Daniel Walker
  2005-09-01 22:21   ` Daniel Walker
  1 sibling, 2 replies; 5+ messages in thread
From: Alexey Dobriyan @ 2005-09-01 20:10 UTC (permalink / raw)
  To: Daniel Walker; +Cc: akpm, linux-kernel

On Thu, Sep 01, 2005 at 12:38:21PM -0700, Daniel Walker wrote:
> This patch should handle the case when scsi_add_host() fails.

> --- linux-2.6.13.orig/drivers/scsi/aic7xxx/aic79xx_osm.c
> +++ linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c

> @@ -2065,7 +2066,11 @@ ahd_linux_register_host(struct ahd_softc
>  	ahd_unlock(ahd, &s);
>  
>  #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
> -	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
> +	error = scsi_add_host(host, &ahd->dev_softc->dev); 
> +	if (error) {
> +		scsi_host_put(host);
> +		return(error);
> +	}
>  	scsi_scan_host(host);
>  #endif
>  	return (0);

I see malloc(), kernel_thread() and multiple ahd_linux_alloc_target()
above. Ditto for 7xxx patch.


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

* Re: [PATCH 2.6.13] Unhandled error condition in aic79xx
  2005-09-01 20:10 ` Alexey Dobriyan
@ 2005-09-01 20:19   ` Daniel Walker
  2005-09-01 22:21   ` Daniel Walker
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Walker @ 2005-09-01 20:19 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel

On Fri, 2005-09-02 at 00:10 +0400, Alexey Dobriyan wrote:

> I see malloc(), kernel_thread() and multiple ahd_linux_alloc_target()
> above. Ditto for 7xxx patch.
> 

True, no wonder this condition hasn't been handled yet..

Daniel


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

* Re: [PATCH 2.6.13] Unhandled error condition in aic79xx
  2005-09-01 20:10 ` Alexey Dobriyan
  2005-09-01 20:19   ` Daniel Walker
@ 2005-09-01 22:21   ` Daniel Walker
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Walker @ 2005-09-01 22:21 UTC (permalink / raw)
  To: Alexey Dobriyan; +Cc: akpm, linux-kernel, jirislaby

On Fri, 2005-09-02 at 00:10 +0400, Alexey Dobriyan wrote:

> I see malloc(), kernel_thread() and multiple ahd_linux_alloc_target()
> above. Ditto for 7xxx patch.

It looks like it's all handled inside ahd_free() . Here's the updated
patch. Any concerns? 

Signed-Off-By: Daniel Walker <dwalker@mvista.com>

Index: linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c
===================================================================
--- linux-2.6.13.orig/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-08-28 23:41:01.000000000 +0000
+++ linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c	2005-09-01 22:16:10.000000000 +0000
@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softc
 	char	*new_name;
 	u_long	s;
 	u_long	target;
+	int error = 0;
 
 	template->name = ahd->description;
 	host = scsi_host_alloc(template, sizeof(struct ahd_softc *));
@@ -2064,10 +2065,14 @@ ahd_linux_register_host(struct ahd_softc
 	ahd_linux_start_dv(ahd);
 	ahd_unlock(ahd, &s);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
-	scsi_add_host(host, &ahd->dev_softc->dev); /* XXX handle failure */
+	error = scsi_add_host(host, &ahd->dev_softc->dev); 
+	if (error) {
+		ahd_free(ahd);
+		scsi_host_put(host);
+		return error;
+	}
 	scsi_scan_host(host);
-#endif
+
 	return (0);
 }
 
\f\rc link
\f
aph
\x16
ÐhÝ\f)





ph

D
 
Ö\fc link


\x7fë\f\x11
;
\x19
h@ 
\x11\rc link


\x11
dw\x19

È\x7fë\f\x11
===h
\x19
h@ 


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

end of thread, other threads:[~2005-09-01 22:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-09-01 19:38 [PATCH 2.6.13] Unhandled error condition in aic79xx Daniel Walker
2005-09-01 19:59 ` Jiri Slaby
2005-09-01 20:10 ` Alexey Dobriyan
2005-09-01 20:19   ` Daniel Walker
2005-09-01 22:21   ` Daniel Walker

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