deadsimple BSD Security Advisories and Announcements

FreeBSD Errata Notice

Hash: SHA512

=============================================================================                                            Errata Notice
                                                          The FreeBSD Project

Topic:          Kernel memory corruption during SCSI error recovery

Category:       core
Module:         cam
Announced:      2022-08-09
Affects:        All supported versions of FreeBSD.
Corrected:      2022-05-03 20:32:45 UTC (stable/13, 13.1-STABLE)
                2022-08-09 20:01:20 UTC (releng/13.1, 13.1-RELEASE-p1)
                2022-08-09 20:00:26 UTC (releng/13.0, 13.0-RELEASE-p12)
                2022-05-04 01:04:43 UTC (stable/12, 12.3-STABLE)
                2022-08-09 19:59:40 UTC (releng/12.3, 12.3-RELEASE-p6)

For general information regarding FreeBSD Errata Notices and Security
Advisories, including descriptions of the fields above, security
branches, and the following sections, please visit

I.   Background

CAM (Common Access Method) is a FreeBSD kernel subsystem which handles
various aspects of storage device management.  Among other
responsibilities, it handles device error recovery and can automatically
retransmit commands to peripheral devices when a transient error is

II.  Problem Description

When a CAM-managed device responds to a command with an error condition,
CAM may automatically retry the command following some error recovery
protocol.  For instance, it may send a SCSI START UNIT command to the
device before retrying the failed command.  In this case, an in-memory
copy of the original command is preserved for a later retry.  However,
a specific portion of the command state was not saved correctly, and
upon a retry this could lead to memory corruption.

III. Impact

The bug can cause kernel panics or other system-level misbehaviour.

IV.  Workaround

No workaround is available.

V.   Solution

Upgrade your system to a supported FreeBSD stable or release / security
branch (releng) dated after the correction date and reboot.

Perform one of the following:

1) To update your system via a binary patch:

Systems running a RELEASE version of FreeBSD on the amd64, i386, or
(on FreeBSD 13 and later) arm64 platforms can be updated via the
freebsd-update(8) utility:

# freebsd-update fetch
# freebsd-update install
# shutdown -r +10min "Rebooting for an errata update"

2) To update your system via a source code patch:

The following patches have been verified to apply to the applicable
FreeBSD release branches.

a) Download the relevant patch from the location below, and verify the
detached PGP signature using your PGP utility.

# fetch
# fetch
# gpg --verify cam.patch.asc

b) Apply the patch.  Execute the following commands as root:

# cd /usr/src
# patch < /path/to/patch

c) Recompile your kernel as described in
<URL:> and reboot the

VI.  Correction details

This issue is corrected by the corresponding Git commit hash or Subversion
revision number in the following stable and release branches:

Branch/path                             Hash                     Revision
- -------------------------------------------------------------------------
stable/13/                              84849cfd1dc0    stable/13-n250673
releng/13.1/                            db8082886fd8  releng/13.1-n250149
releng/13.0/                            5430423b6d63  releng/13.0-n244803
stable/12/                                                        r372069
releng/12.3/                                                      r372378
- -------------------------------------------------------------------------

For FreeBSD 13 and later:

Run the following command to see which files were modified by a
particular commit:

# git show --stat <commit hash>

Or visit the following URL, replacing NNNNNN with the hash:


To determine the commit count in a working tree (for comparison against
nNNNNNN in the table above), run:

# git rev-list --count --first-parent HEAD

For FreeBSD 12 and earlier:

Run the following command to see which files were modified by a particular
revision, replacing NNNNNN with the revision number:

# svn diff -cNNNNNN --summarize svn://

Or visit the following URL, replacing NNNNNN with the revision number:


VII. References


The latest revision of this advisory is available at