* [PATCH] scsi: myrs: Put the SCSI device after logging a physical event
@ 2026-11-12 7:17 Zhu Jun
2026-11-12 7:25 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Zhu Jun @ 2026-11-12 7:17 UTC (permalink / raw)
To: hare; +Cc: James.Bottomley, mkp, linux-scsi, linux-kernel, Zhu Jun
myrs_log_event() takes a SCSI device reference when processing a
physical-device event, but does not release it after logging the event
and updating the cached device state. Each matching event leaks a
device reference and a reference to the low-level driver module.
Put the device after processing the physical event, including when no
host-private information is available.
Fixes: 77266186397c ("scsi: myrs: Add Mylex RAID controller (SCSI interface)")
Signed-off-by: Zhu Jun <zhujun2@cmss.chinamobile.com>
---
drivers/scsi/myrs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
index 1192b01fab8e..1f248501a611 100644
--- a/drivers/scsi/myrs.c
+++ b/drivers/scsi/myrs.c
@@ -877,6 +877,8 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)
break;
}
}
+ if (sdev)
+ scsi_device_put(sdev);
break;
case 'L':
shost_printk(KERN_INFO, shost,
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: myrs: Put the SCSI device after logging a physical event
2026-11-12 7:17 [PATCH] scsi: myrs: Put the SCSI device after logging a physical event Zhu Jun
@ 2026-11-12 7:25 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-12 7:25 UTC (permalink / raw)
To: Zhu Jun; +Cc: linux-scsi
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Medium] scsi: myrs: silent drop of physical device events in
myrs_log_event() [1]
--
commit ac88587479e352e8cedb430c156919340b859e81
Author: Zhu Jun <zhujun2@cmss.chinamobile.com>
scsi: myrs: Put the SCSI device after logging a physical event
This commit calls scsi_device_put() in myrs_log_event() to release the
SCSI device reference acquired via scsi_device_lookup() when handling a
physical device event.
> diff --git a/drivers/scsi/myrs.c b/drivers/scsi/myrs.c
> index 1192b01fab8ec..1f248501a611f 100644
> --- a/drivers/scsi/myrs.c
> +++ b/drivers/scsi/myrs.c
> @@ -877,6 +877,8 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)
> break;
> }
> }
> + if (sdev)
> + scsi_device_put(sdev);
> break;
> case 'L':
> shost_printk(KERN_INFO, shost,
[Severity: Medium]
This problem wasn't introduced by this patch, but does myrs_log_event()
silently drop physical device events [1] when scsi_device_lookup()
returns NULL?
drivers/scsi/myrs.c:myrs_log_event() {
...
case 'P':
sdev = scsi_device_lookup(shost, ev->channel,
ev->target, 0);
sdev_printk(KERN_INFO, sdev, "event %d: Physical Device %s\n",
ev->ev_seq, ev_msg);
...
}
When a physical drive is hidden by the controller, unconfigured, or
already removed, scsi_device_lookup() returns NULL. Because sdev_printk()
-> sdev_prefix_printk() returns immediately when sdev is NULL instead of
falling back to shost_printk(), drive failure and removal events are never
logged.
[1] https://sashiko.dev/#/bug/linux-5aadc823-d60c-4405-bf84-45e4ed87504d
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261112071752.154639-1-zhujun2@cmss.chinamobile.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-12 7:25 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 7:17 [PATCH] scsi: myrs: Put the SCSI device after logging a physical event Zhu Jun
2026-11-12 7:25 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox