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

[v0.20] Nil CDI manager can cause errors #5724

Closed
tonistiigi opened this issue Feb 12, 2025 · 1 comment · Fixed by #5729
Closed

[v0.20] Nil CDI manager can cause errors #5724

tonistiigi opened this issue Feb 12, 2025 · 1 comment · Fixed by #5729
Milestone

Comments

@tonistiigi
Copy link
Member

When CDI is disabled in the config, it is initialized to nil value. Looks like while some code paths like ListDevices handle nil value, some like InjectDevices do not.

@tonistiigi tonistiigi added this to the v0.20.0 milestone Feb 12, 2025
@crazy-max
Copy link
Member

crazy-max commented Feb 12, 2025

Looks like while some code paths like ListDevices handle nil value, some like InjectDevices do not.

InjectDevices is only called through

func generateCDIOpts(manager *cdidevices.Manager, devs []*pb.CDIDevice) ([]oci.SpecOpts, error) {

But we check if cdiManager is not nil in such case:

if cdiManager != nil {
if cdiOpts, err := generateCDIOpts(cdiManager, meta.CDIDevices); err == nil {
opts = append(opts, cdiOpts...)
} else {
return nil, nil, err
}
}

The only case I see where it could panic is

setup, ok := e.w.CDIManager().OnDemandInstaller(d.Name)

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

Successfully merging a pull request may close this issue.

2 participants