On 07/03/2023 21:44, Bart Van Assche wrote:
scsi_proc_hostdir_rm() decreases a reference counter and hence must
only be called once per host that is removed. This change does not
require a scsi_add_host_with_dma() change since scsi_add_host_with_dma()
will return 0 (success) if scsi_proc_host_add() is called.
Cc: John Garry <john.g.garry@xxxxxxxxxx>
Reported-by: John Garry <john.g.garry@xxxxxxxxxx>
Reported-by: syzbot+645a4616b87a2f10e398@xxxxxxxxxxxxxxxxxxxxxxxxx
Fixes: fc663711b944 ("scsi: core: Remove the /proc/scsi/${proc_name} directory earlier")
Signed-off-by: Bart Van Assche <bvanassche@xxxxxxx>
Well that seemed to fix my issue, so:
Tested-by: John Garry <john.g.garry@xxxxxxxxxx>
I don't really know why we ever had this call in scsi_host_dev_release()
or what races which fc663711b944 was trying to fix.
BTW, maybe later we combine the calls to scsi_proc_host_rm() and
scsi_proc_hostdir_rm() - they're only ever called together AFAICS.
Thanks,
John
---
drivers/scsi/hosts.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index f7f62e56afca..9b6fbbe15d92 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -341,9 +341,6 @@ static void scsi_host_dev_release(struct device *dev)
struct Scsi_Host *shost = dev_to_shost(dev);
struct device *parent = dev->parent;
- /* In case scsi_remove_host() has not been called. */
- scsi_proc_hostdir_rm(shost->hostt);
-
/* Wait for functions invoked through call_rcu(&scmd->rcu, ...) */
rcu_barrier();