aboutsummaryrefslogtreecommitdiff
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 20:06:40 +0000
commitcd7c996c4ed94c195e14e33e6173e91e5bbc6f29 (patch)
tree21c75c4700b89a630a1377773f167ce691de2533
parent38a360a502db32ad256e7ab1a377e8bf32323b4f (diff)
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 MFC after: 1 week Sponsored by: iXsystems, Inc. (cherry picked from commit 404f001161b975164d8b52d9f404d07ac7584027) (cherry picked from commit 8dab6aba5f6ee635e4ff3f313d0209af718ea42f)
-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 c53be6d61fa7..30423f4d72a0 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1440,6 +1440,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)