Skip to content

update slots command crashes director when device or autochanger disappears#919

Merged
arogge merged 2 commits intobareos:masterfrom
alaaeddineelamri:dev/alaaeddineelamri/master/update-slots-crash-when-device-disappears
Sep 9, 2021
Merged

update slots command crashes director when device or autochanger disappears#919
arogge merged 2 commits intobareos:masterfrom
alaaeddineelamri:dev/alaaeddineelamri/master/update-slots-crash-when-device-disappears

Conversation

@alaaeddineelamri
Copy link
Contributor

@alaaeddineelamri alaaeddineelamri commented Sep 8, 2021

Description

When there is an issue communicating with an autochanger or tape device, the director could crash when executing an update slots command in bconsole. This PR fixes the issue.

Please check

  • Short description and the purpose of this PR is present above this paragraph
  • Your name is present in the AUTHORS file (optional)

If you have any questions or problems, please give a comment in the PR.

Helpful documentation and best practices

Checklist for the reviewer of the PR (will be processed by the Bareos team)

General
  • PR name is meaningful
  • Purpose of the PR is understood
  • Separate commit for this PR in the CHANGELOG.md, PR number referenced is same
  • Commit descriptions are understandable and well formatted
Source code quality
  • Source code changes are understandable
  • Variable and function names are meaningful
  • Code comments are correct (logically and spelling)
  • Required documentation changes are present and part of the PR
  • bareos-check-sources --since-merge does not report any problems
  • git status should not report modifications in the source tree after building and testing

Alaa Eddine Elamri added 2 commits September 8, 2021 11:25
When in the while loop, the `vl` variable gets allocated some memory AFTER the fields check, and then this memory gets freed later in the loop. But when there is an iteration that stops at the check and gets redirected to `parse_error`, it has to free memory that was already freed in a previous iteration of the loop, which creates a double free situation that crashes the director.
@arogge
Copy link
Member

arogge commented Sep 9, 2021

Do you think you could implement a unit-test for that and do you think it is worth the effort?

Copy link
Member

@arogge arogge left a comment

Choose a reason for hiding this comment

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

Looks great. Thank you!

@arogge arogge merged commit 477351d into bareos:master Sep 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants