Check that SecurityContext is not nil before dereferencing
@@ -111,7 +111,7 @@ func findCgroupMountpoint(name string) error {
func addDevicesPlatform(ctx context.Context, sb *sandbox.Sandbox, containerConfig *pb.ContainerConfig, privilegedWithoutHostDevices bool, specgen *generate.Generator) error {
sp := specgen.Config
- if containerConfig.GetLinux().GetSecurityContext().GetPrivileged() && !privilegedWithoutHostDevices {
+ if containerConfig.GetLinux().GetSecurityContext() != nil && containerConfig.GetLinux().GetSecurityContext().GetPrivileged() && !privilegedWithoutHostDevices {
hostDevices, err := devices.HostDevices()
if err != nil {
return err
