Fix nil pointer panic in verifyDisabledVFs for non-SR-IOV GPUs#1186
Conversation
GPUs that do not support SR-IOV (e.g. NVIDIA T400) have SriovInfo.PhysicalFunction set to nil. The existing code dereferences PhysicalFunction.NumVFs without a nil check, causing a panic when VFIO passthrough is configured for such GPUs. Add nil checks for both the gpu return value and PhysicalFunction. A nil PhysicalFunction means no VFs can exist, so it is safe to proceed. Signed-off-by: Miaoxiang <miaoxiang.philips@gmail.com>
✅ Deploy Preview for dra-driver-nvidia-gpu canceled.
|
|
|
|
Welcome @Miaoxiang-philips! |
|
Hi @Miaoxiang-philips. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions 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-sigs/prow repository. |
|
/assign @varunrsekar |
|
@Miaoxiang-philips Thanks for proposing this fix. Please sign the CLA. |
varunrsekar
left a comment
There was a problem hiding this comment.
Good catch. Thanks for fixing this.
/skip-tests
/lgtm
|
LGTM label has been added. DetailsGit tree hash: 2fce439c8bf922346668d885ec0d3557ffcd1b71 |
|
/hold |
|
Hi @shivamerla I have signed the CLA |
|
/hold cancel |
|
/approve |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Miaoxiang-philips, shivamerla The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherry-pick release-0.4 |
|
@shivamerla: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
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-sigs/prow repository. |
|
@shivamerla: new pull request created: #1194 DetailsIn response to this:
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-sigs/prow repository. |
GPUs that do not support SR-IOV (e.g. NVIDIA T400) have SriovInfo.PhysicalFunction set to nil. The existing code dereferences PhysicalFunction.NumVFs without a nil check, causing a panic when VFIO passthrough is configured for such GPUs.
Add nil checks for both the gpu return value and PhysicalFunction. A nil PhysicalFunction means no VFs can exist, so it is safe to proceed.
What type of PR is this?
/kind bug
What this PR does / why we need it:
fix #1185
Which issue(s) this PR is related to:
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation (design docs, usage docs, etc.):
Checklist
make check testpasses locallymake check-generatepasses ifapi/changed (CRDs, deepcopy, informers, listers, clientset)make check-modulespasses ifgo.mod/go.sumchangeddeployments/helm) updated if flags, RBAC, or defaults changed