Skip to content

linux/zvol_os: don't try to set disk ops if alloc fails #17396

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 30, 2025

Conversation

robn
Copy link
Member

@robn robn commented May 29, 2025

[Sponsors: Klara, Inc.]

Motivation and Context

Just a trivial crasher noticed during experimenting.

If the kernel fails to allocate the gendisk, zvo_disk will be NULL, and derefencing it will explode.

Description

Don't do that.

How Has This Been Tested?

By hand. No trivial reproducer; exhausting kernel memory is pretty niche. But it's an obvious bug.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Quality assurance (non-breaking change which makes the code more robust against bugs)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

If the kernel fails to allocate the gendisk, zvo_disk will be NULL, and
derefencing it will explode. So don't do that.

Sponsored-by: Klara, Inc.
Signed-off-by: Rob Norris <[email protected]>
@amotin amotin added the Status: Code Review Needed Ready for review and testing label May 29, 2025
@tonyhutter tonyhutter added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels May 29, 2025
@amotin amotin merged commit 0c94d38 into openzfs:master May 30, 2025
37 of 40 checks passed
@JakeCooper
Copy link

Any idea when next release might be to get one cut with this inside it?

@behlendorf
Copy link
Contributor

I'll pull this fix in to the next 2.2.x and 2.3.x releases. We're finalizing 2.2.8 now.

behlendorf pushed a commit to tonyhutter/zfs that referenced this pull request Jun 3, 2025
If the kernel fails to allocate the gendisk, zvo_disk will be NULL, and
derefencing it will explode. So don't do that.

Sponsored-by: Klara, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Tony Hutter <[email protected]>
Signed-off-by: Rob Norris <[email protected]>
Closes openzfs#17396
@JakeCooper
Copy link

JakeCooper commented Jun 4, 2025

Gotchya. Any eyes on a 2.3.3 timeline? Apologies to be pushy just have some hosts we'd like to patch since we, on very rare occasions, have run into this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants