Skip to content

libcni: skip GC plugin execution after config injection failure - #1184

Open
grey3228 wants to merge 1 commit into
containernetworking:mainfrom
grey3228:fix/nil-plugin-cfg-deref
Open

libcni: skip GC plugin execution after config injection failure#1184
grey3228 wants to merge 1 commit into
containernetworking:mainfrom
grey3228:fix/nil-plugin-cfg-deref

Conversation

@grey3228

Copy link
Copy Markdown

This fixes error handling in GCNetworkList.

When generating a GC plugin configuration fails, GCNetworkList currently records the error but continues and calls gcNetwork(ctx, pluginConfig). InjectConf returns nil on failure, so this can lead to a nil pointer dereference inside gcNetwork.

The proposed fix is to continue after recording the configuration generation error.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

GCNetworkList records errors returned by InjectConf, but still passes the
returned pluginConfig to gcNetwork. InjectConf returns a nil PluginConfig on
failure, so gcNetwork may panic when dereferencing net.Network.Type.

Skip execution of that plugin after recording the configuration
generation error. Also use pluginDescription when formatting plugin
errors to avoid unnecessary dereferences while reporting failures.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Signed-off-by: Mikhail Dmitrichenko <m.dmitrichenko222@gmail.com>
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 this pull request may close these issues.

1 participant