On Mon, 9 Apr 2018 23:23:51 -0700
Anatoliy Glagolev <glago...@gmail.com> wrote:

> Description:
> SCSI mid-layer may hold references to Scsi_Host structs when
> the owning module has already unloaded. Scsi_Host release path
> touches scsi_host_template struct that is usually allocated
> in the unloaded module's memory. That results in a crash.
> To work around the problem, this change implements
> scsi_host_template_release API to be called at driver unload
> path to make sure all Scsi_Host structs are gone before
> releasing scsi_host_template memory.
> 
> ---
>  drivers/scsi/hosts.c          |  2 ++
>  drivers/scsi/qla2xxx/qla_os.c |  2 ++
>  drivers/scsi/scsi_priv.h      |  1 +
>  drivers/scsi/scsi_proc.c      | 64
> +++++++++++++++++++++++++++++++++++++++----
> include/scsi/scsi_host.h      | 17 ++++++++++++ 5 files changed, 80
> insertions(+), 6 deletions(-)
> 

Whee, that is ugly.

Any particular reason why we can't do refcounting here?

Cheers,

Hannes

Reply via email to