Some drivers such as aha1542 and aic7xxx_old will call scsi_register() and then, if some succeeding operations fails they will call scsi_unregister(), without an intervening scsi_set_host(). This causes an oops in scsi_put_device(), because kobj->parent is NULL. In other words, scsi_register() immediately followed by scsi_unregister() is guaranteed to oops. The patch makes scsi_host_dev_release() more robust against this usage pattern. drivers/scsi/hosts.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletion(-) diff -puN drivers/scsi/hosts.c~aha1542-oops-fix drivers/scsi/hosts.c --- 25/drivers/scsi/hosts.c~aha1542-oops-fix 2003-08-29 19:48:37.000000000 -0700 +++ 25-akpm/drivers/scsi/hosts.c 2003-08-29 20:09:34.000000000 -0700 @@ -158,7 +158,13 @@ static void scsi_host_dev_release(struct scsi_proc_hostdir_rm(shost->hostt); scsi_destroy_command_freelist(shost); - put_device(parent); + /* + * Some drivers (eg aha1542) do scsi_register()/scsi_unregister() + * during probing without performing a scsi_set_device() in between. + * In this case dev->parent is NULL. + */ + if (parent) + put_device(parent); kfree(shost); } _