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

fix: azure_loadbalancer.go: don't use service.Name, when service is nil #5266

Merged
merged 1 commit into from Jan 10, 2024

Conversation

damdo
Copy link
Member

@damdo damdo commented Jan 10, 2024

What type of PR is this?

/kind bug

What this PR does / why we need it:

Summary:
The service object is always nil when code execution reaches this line and as such, logging service.Name will result in a nil pointer dereference panic (see this panic log (note that this comes from an older fork, so panic code lines might not exactly match)).

Analysis:
If if !serviceExists is satisfied, we log a line with service.Name
But for the execution to branch into if !serviceExists, serviceExists must be false.
Looking at getLatestService where service and serviceExists come from, you’ll see that the only case when serviceExists is false, service is nil, resulting in a nil pointer dereference panic.
Changing to serviceName (a pre populated string) instead of service.Name should fix this issue.

Does this PR introduce a user-facing change?

fix: azure_loadbalancer.go: don't use service.Name, when service is nil

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Jan 10, 2024
@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jan 10, 2024
@damdo
Copy link
Member Author

damdo commented Jan 10, 2024

/assign @feiskyer @nilo19 @MartinForReal

@nilo19
Copy link
Contributor

nilo19 commented Jan 10, 2024

/lgtm

@nilo19
Copy link
Contributor

nilo19 commented Jan 10, 2024

/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jan 10, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: damdo, nilo19

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 10, 2024
@k8s-ci-robot k8s-ci-robot merged commit 59da6bc into kubernetes-sigs:master Jan 10, 2024
18 checks passed
@nilo19
Copy link
Contributor

nilo19 commented Jan 11, 2024

/cherrypick release-1.28

@k8s-infra-cherrypick-robot

@nilo19: new pull request created: #5269

In response to this:

/cherrypick release-1.28

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@nilo19
Copy link
Contributor

nilo19 commented Jan 11, 2024

/cherrypick release-1.27

@nilo19
Copy link
Contributor

nilo19 commented Jan 11, 2024

/cherrypick release-1.26

@nilo19
Copy link
Contributor

nilo19 commented Jan 11, 2024

/cherrypick release-1.25

@k8s-infra-cherrypick-robot

@nilo19: new pull request created: #5273

In response to this:

/cherrypick release-1.27

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-infra-cherrypick-robot

@nilo19: new pull request created: #5274

In response to this:

/cherrypick release-1.26

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-infra-cherrypick-robot

@nilo19: new pull request created: #5275

In response to this:

/cherrypick release-1.25

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants