Skip to content

FreeBSD: Prevent NULL pointer dereference of resid #11149

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
Nov 5, 2020

Conversation

khng300
Copy link
Contributor

@khng300 khng300 commented Nov 4, 2020

Motivation and Context

This change attempts to fix spa_config_load() panicking due to NULL referencing in zfs_file_read(). It could be triggered by vfs.zfs.autoimport_disable=0 in kenv.

Description

A line is added to check resid being a NULL pointer.

How Has This Been Tested?

It is checked by running with vfs.zfs.autoimport_disable=0.

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)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation (a change to man pages or other documentation)

Checklist:

spa_config_load() passes NULL into resid when doing zfs_file_read().
This would trip over when vfs.zfs.autoimport_disable=0.

Sponsored by: The FreeBSD Foundation
Signed-off-by: Ka Ho Ng <[email protected]>
Copy link
Contributor

@allanjude allanjude left a comment

Choose a reason for hiding this comment

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

yeah, the call from spa_config_load() passes NULL as the resid argument, so this check is required for that to work.

Reviewed-By: Allan Jude [email protected]

@behlendorf behlendorf added the Status: Accepted Ready to integrate (reviewed, tested) label Nov 4, 2020
@khng300 khng300 force-pushed the fix-resid-null-fbsd branch 2 times, most recently from 604a31d to a2b0398 Compare November 4, 2020 18:56
@behlendorf behlendorf merged commit a4246bc into openzfs:master Nov 5, 2020
behlendorf pushed a commit that referenced this pull request Nov 11, 2020
spa_config_load() passes NULL into resid when doing zfs_file_read().
This would trip over when vfs.zfs.autoimport_disable=0.

Sponsored by: The FreeBSD Foundation
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Signed-off-by: Ka Ho Ng <[email protected]>
Closes #11149
jsai20 pushed a commit to jsai20/zfs that referenced this pull request Mar 30, 2021
spa_config_load() passes NULL into resid when doing zfs_file_read().
This would trip over when vfs.zfs.autoimport_disable=0.

Sponsored by: The FreeBSD Foundation
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Signed-off-by: Ka Ho Ng <[email protected]>
Closes openzfs#11149
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
spa_config_load() passes NULL into resid when doing zfs_file_read().
This would trip over when vfs.zfs.autoimport_disable=0.

Sponsored by: The FreeBSD Foundation
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Allan Jude <[email protected]>
Signed-off-by: Ka Ho Ng <[email protected]>
Closes openzfs#11149
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.

3 participants