svn commit: r365445 - head/sys/cam/mmc
Andriy Gapon
avg at FreeBSD.org
Tue Sep 8 05:46:11 UTC 2020
Author: avg
Date: Tue Sep 8 05:46:10 2020
New Revision: 365445
URL: https://svnweb.freebsd.org/changeset/base/365445
Log:
mmc_da: make sure that part_index is not used uninitialized in sddastart
This is a fix to r334065.
Without this change I once got stuck I/O with endless partition switching:
(sdda0:aw_mmc_sim2:0:0:0): sddastart
(sdda0:aw_mmc_sim2:0:0:0): Partition 0 -> -525703168
(sdda0:aw_mmc_sim2:0:0:0): xpt_action: func 0x91d XPT_MMC_IO
(sdda0:aw_mmc_sim2:0:0:0): xpt_done: func= 0x91d XPT_MMC_IO status 0x1
(sdda0:aw_mmc_sim2:0:0:0): sddadone
(sdda0:aw_mmc_sim2:0:0:0): Card status: 00000000
(sdda0:aw_mmc_sim2:0:0:0): Current state: 4
(sdda0:aw_mmc_sim2:0:0:0): Compteting partition switch to 0
Note that -525703168 (an int) is 0xe0aa6800 in binary representation.
The partition indexes are actually stored as uint8_t, so that value
was converted / truncated to zero.
MFC after: 1 week
Modified:
head/sys/cam/mmc/mmc_da.c
Modified: head/sys/cam/mmc/mmc_da.c
==============================================================================
--- head/sys/cam/mmc/mmc_da.c Tue Sep 8 04:44:37 2020 (r365444)
+++ head/sys/cam/mmc/mmc_da.c Tue Sep 8 05:46:10 2020 (r365445)
@@ -1808,6 +1808,7 @@ sddastart(struct cam_periph *periph, union ccb *start_
}
/* Find partition that has outstanding commands. Prefer current partition. */
+ part_index = softc->part_curr;
part = softc->part[softc->part_curr];
bp = bioq_first(&part->bio_queue);
if (bp == NULL) {
More information about the svn-src-all
mailing list