Skip to content
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

[linux] storage: check if devnode is valid pointer #20111

Merged
merged 1 commit into from Apr 27, 2022

Conversation

illiliti
Copy link
Contributor

@illiliti illiliti commented Sep 5, 2021

Description

Prevent segfault if udev_device_get_devnode() returned NULL.

Motivation and context

This change fixes segfault when udev_device doesn't have devnode.

How has this been tested?

Tested on Alpine linux with libudev-zero(master branch)

Types of change

  • Bug fix (non-breaking change which fixes an issue)
  • Clean up (non-breaking change which removes non-working, unmaintained functionality)
  • Improvement (non-breaking change which improves existing functionality)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that will cause existing functionality to change)
  • Cosmetic change (non-breaking change that doesn't touch code)
  • None of the above (please explain below)

Checklist:

  • My code follows the Code Guidelines of this project
  • My change requires a change to the documentation, either Doxygen or wiki
  • I have updated the documentation accordingly
  • I have read the Contributing document
  • I have added tests to cover my change
  • All new and existing tests passed

@lrusak
Copy link
Contributor

lrusak commented Sep 5, 2021

Thanks for the PR.

Can you change this to check for nullptr before even calling get_mountpoint

const char* devnode = udev_device_get_devnode(device);
if (!devnode)
{
  udev_device_unref(device);
  continue;
}

const char *mountpoint = get_mountpoint(devnode);

@illiliti illiliti force-pushed the check_devnode branch 3 times, most recently from 4f15a69 to f914c29 Compare September 5, 2021 16:34
Prevent segfault if udev_device_get_devnode() returned NULL.
@illiliti
Copy link
Contributor Author

illiliti commented Sep 5, 2021

@lrusak Done. I don't know what this bot wants from me. I already applied this diff

@lrusak lrusak added Component: System Platform: Linux Type: Fix non-breaking change which fixes an issue v20 Nexus labels Sep 5, 2021
@lrusak lrusak added this to the Nexus 20.0 Alpha 1 milestone Sep 5, 2021
@fuzzard fuzzard closed this Sep 7, 2021
@fuzzard fuzzard reopened this Sep 7, 2021
@fuzzard
Copy link
Contributor

fuzzard commented Apr 24, 2022

@lrusak you happy for this to merge?

@lrusak
Copy link
Contributor

lrusak commented Apr 25, 2022

Yea looks ok.

@fuzzard fuzzard merged commit 2b6cc75 into xbmc:master Apr 27, 2022
@fuzzard
Copy link
Contributor

fuzzard commented Apr 27, 2022

Thanks for the contribution, apologies it lingered for so long.

@garbear
Copy link
Member

garbear commented Apr 27, 2022

Indeed, @illiliti congrats on your first PR merged in Kodi!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants