aboutsummaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2022-04-28 01:39:50 +0000
committerMark Johnston <markj@FreeBSD.org>2022-07-25 21:09:17 +0000
commit5430423b6d63b76548ed23efff5d33b7ebeefd05 (patch)
treea676a0e7ba33c6f8e5f8f5706837184c186bfa2d /sys
parent277c0c4d2512228bfd25e762cc1517b216a37238 (diff)
downloadsrc-5430423b6d63b76548ed23efff5d33b7ebeefd05.tar.gz
src-5430423b6d63b76548ed23efff5d33b7ebeefd05.zip
CAM: Keep periph_links when restoring CCB in camperiphdone().
While recovery command executed, some other commands from the periph may complete, that may affect periph_links of this CCB. So restoring original CCB we must keep current periph_links as more up to date. I've found this triggering assertions with debug kernel and suspect some memory corruptions otherwise when spun down disk receives two or sometimes more concurrent requests. Approved by: so Security: FreeBSD-EN-22:17.cam Sponsored by: iXsystems, Inc. (cherry picked from commit 404f001161b975164d8b52d9f404d07ac7584027) (cherry picked from commit 84849cfd1dc016917402511bc5a55d3d7317ce39)
Diffstat (limited to 'sys')
-rw-r--r--sys/cam/cam_periph.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 92f7c33cbc75..8c3956d641be 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1416,6 +1416,7 @@ camperiphdone(struct cam_periph *periph, union ccb *done_ccb)
* and the result will be the final one returned to the CCB owher.
*/
saved_ccb = (union ccb *)done_ccb->ccb_h.saved_ccb_ptr;
+ saved_ccb->ccb_h.periph_links = done_ccb->ccb_h.periph_links;
bcopy(saved_ccb, done_ccb, sizeof(*done_ccb));
xpt_free_ccb(saved_ccb);
if (done_ccb->ccb_h.cbfcnp != camperiphdone)