⬢ DragonFlyBSD Kernel Audit
DF-3846 / fix.diff
← back to finding ↓ download raw
diff -u -p -r /tmp/opencode/fix/p3846_base/raid/mrsas.c /tmp/opencode/fix/p3846_mod/raid/mrsas.c
--- a/sys/dev/raid/mrsas/mrsas.c	2026-09-16 14:47:26.492997050 +0000
+++ b/sys/dev/raid/mrsas/mrsas.c	2026-09-16 14:47:26.496996999 +0000
@@ -2451,6 +2451,9 @@ int mrsas_reset_ctrl(struct mrsas_softc
                     mfi_cmd = sc->mfi_cmd_list[mpt_cmd->sync_cmd_idx];
                     if (mfi_cmd->frame->dcmd.opcode ==
                                           MR_DCMD_LD_MAP_GET_INFO) {
+                        /* DF-3846: dropping the map-sync cmd here too */
+                        if (sc->map_update_cmd == mfi_cmd)
+                            sc->map_update_cmd = NULL;
                         mrsas_release_mfi_cmd(mfi_cmd);
                         mrsas_release_mpt_cmd(mpt_cmd);
                     } else  {
@@ -2950,6 +2953,9 @@ mrsas_complete_mptmfi_passthru(struct mr
                     if (cmd_status != MFI_STAT_NOT_FOUND)
                         device_printf(sc->mrsas_dev, "map sync failed, status=%x\n",cmd_status);
                     else {
+                        /* DF-3846: no follow-up sync; drop the handle */
+                        if (sc->map_update_cmd == cmd)
+                            sc->map_update_cmd = NULL;
                         mrsas_release_mfi_cmd(cmd);
 		        lockmgr(&sc->raidmap_lock, LK_RELEASE);
                         break;
@@ -2957,6 +2963,9 @@ mrsas_complete_mptmfi_passthru(struct mr
                 } 
                 else 
                     sc->map_id++;
+                /* DF-3846: cmd is about to return to the pool */
+                if (sc->map_update_cmd == cmd)
+                    sc->map_update_cmd = NULL;
                 mrsas_release_mfi_cmd(cmd);
                 if (MR_ValidateMapInfo(sc))
                     sc->fast_path_io = 0;