Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174886794
D60335.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
930 B
Referenced Files
None
Subscribers
None
D60335.diff
View Options
Index: sys/dev/mpi3mr/mpi3mr_app.c
===================================================================
--- sys/dev/mpi3mr/mpi3mr_app.c
+++ sys/dev/mpi3mr/mpi3mr_app.c
@@ -1248,8 +1248,21 @@
sc->mpi3mr_aen_triggered = 0;
out_failed:
- if (tgtdev)
- mpi3mr_atomic_dec(&tgtdev->block_io);
+ if (tgtdev) {
+ /*
+ * Re-resolve the target before decrementing block_io: the raw
+ * tgtdev pointer may point to freed memory if the device was
+ * removed during the potentially long ioctl wait
+ * (karg->timeout is U16, up to 65535 seconds). A fresh lookup
+ * under target_lock is safe; if the target is gone we simply
+ * skip the decrement.
+ */
+ struct mpi3mr_target *tgtdev_recheck =
+ mpi3mr_find_target_by_dev_handle(sc->cam_sc,
+ tm_req->DevHandle);
+ if (tgtdev_recheck)
+ mpi3mr_atomic_dec(&tgtdev_recheck->block_io);
+ }
sc->ioctl_cmds.is_senseprst = 0;
sc->ioctl_cmds.sensebuf = NULL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 7, 6:48 PM (4 h, 18 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40278122
Default Alt Text
D60335.diff (930 B)
Attached To
Mode
D60335: mpi3mr: Safely re-validate target before unblocking I/O in IOCTL error path
Attached
Detach File
Event Timeline
Log In to Comment