Skip to content

snapshots/devmapper: avoid nil status deref after mkfs failure - #13633

Merged
mxpv merged 1 commit into
containerd:mainfrom
grey3228:fix/snapshotter_nil_deref
Jun 26, 2026
Merged

mxpv merged 1 commit into
containerd:mainfrom
grey3228:fix/snapshotter_nil_deref

Conversation

@grey3228

Copy link
Copy Markdown

dmsetup.Status() returns a nil DeviceStatus when it fails. The mkfs failure path records that error, but still unconditionally dereferences status when logging the pool status.

Avoid the panic by logging a fallback status string when dmsetup.Status() does not return a status.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

dmsetup.Status() returns a nil DeviceStatus when it fails.  The mkfs
failure path records that error, but still unconditionally dereferences
status when logging the pool status.

Avoid the panic by logging a fallback status string when dmsetup.Status()
does not return a status.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Ready to approve

The change is minimal, localized to an error path, and directly prevents a confirmed nil dereference without altering the normal success behavior.

Note: this review does not count toward required approvals for merging.

Pull request overview

This PR hardens the devmapper snapshotter’s mkfs failure rollback/logging path by avoiding a nil dereference when dmsetup.Status() fails and returns a nil DeviceStatus, preventing a panic during error reporting.

Changes:

  • Introduce a fallback poolStatus string when dmsetup.Status() returns nil.
  • Update the mkfs failure log message to use the safe poolStatus value instead of unconditionally dereferencing status.RawOutput.
File summaries
File Description
plugins/snapshots/devmapper/snapshotter.go Avoids nil deref in mkfs failure logging by using a fallback pool status string when dmsetup.Status() returns nil.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

Note

Your feedback helps us improve the quality of this feature.
Please use 👍 or 👎 to tell us whether this assessment is correct.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-project-automation github-project-automation Bot moved this from Needs Triage to Review In Progress in Pull Request Review Jun 26, 2026
@mxpv
mxpv added this pull request to the merge queue Jun 26, 2026
Merged via the queue into containerd:main with commit 484c12c Jun 26, 2026
87 of 90 checks passed
@github-project-automation github-project-automation Bot moved this from Review In Progress to Done in Pull Request Review Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants