Unhandled error condition in aic79xx
Subsystems (2)
PATCH 1/1 Unhandled error condition in aic79xx
This patch should handle the case when scsi_add_host() fails.
drivers/scsi/aic7xxx/aic79xx_osm.c +6 -1
@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softcchar *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_softcahd_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 );
Daniel Walker napsal(a):
Quoted 17 lines
This patch should handle the case when
scsi_add_host()fails.Signed-off-by Daniel Walker <[email protected]>Index:
linux-2.6.13/drivers/scsi/aic7xxx/aic79xx_osm.c
===================================================================drivers/scsi/aic7xxx/aic79xx_osm.c +1
-0@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softcchar *new_name;u_long s;u_long target; +int error =0 ; template->name = ahd->description; host =scsi_host_alloc (template,sizeof (struct ahd_softc *));
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_register_host(struct ahd_softc · line 2070
Quoted 5 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +0
-0@@ -2065,7 +2066,11 @@ ahd_linux_register_host(struct ahd_softcahd_unlock (ahd, &s);#if LINUX_VERSION_CODE >=KERNEL_VERSION (2 ,5 ,0 )
Maybe this could go away.
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_register_host(struct ahd_softc
Quoted 7 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +4
-1-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
Quoted 6 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +1
-0+ }scsi_scan_host(host); #endif return (0);
regards,
Signature · 3 lines
Jiri Slaby www.fi.muni.cz/~xslaby ~\-/~ [email protected] ~\-/~ 241B347EC88228DE51EE A49C4A73A25004CB2A10
Quoted 8 lines · Daniel Walker
This patch should handle the case when
scsi_add_host()fails.drivers/scsi/aic7xxx/aic79xx_osm.c +0
-0@@ -2065,7 +2066,11 @@ ahd_linux_register_host(struct ahd_softcahd_unlock (ahd, &s);
drivers/scsi/aic7xxx/aic79xx_osm.c ahd_linux_register_host(struct ahd_softc · line 2076
Quoted 10 lines
drivers/scsi/aic7xxx/aic79xx_osm.c +5
-1#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.
Quoted 3 lines · Alexey Dobriyan
I see
malloc(),kernel_thread()and multipleahd_linux_alloc_target()above. Ditto for 7xxx patch.
True, no wonder this condition hasn't been handled yet..
Daniel
Quoted 2 lines · Alexey Dobriyan
I see
malloc(),kernel_thread()and multipleahd_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?
drivers/scsi/aic7xxx/aic79xx_osm.c +8 -3
@@ -1989,6 +1989,7 @@ ahd_linux_register_host(struct ahd_softcchar *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_softcahd_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 ); }
c link
aph
�h�)
ph
D
�c link
�
;
h@
c link
dw
��
===h
h@