summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
authorPaul Holzinger <pholzing@redhat.com>2022-04-21 14:07:54 +0200
committerPaul Holzinger <pholzing@redhat.com>2022-04-21 14:07:54 +0200
commiteb71712626f96fc0a7e2803a6b6e6f82bec0a3a2 (patch)
tree45b2f08769b411c578eddef7e1e28525f8bade6a /pkg
parent13c6fd067cab2fd21f96837c6b6105ebb740fd1d (diff)
downloadpodman-eb71712626f96fc0a7e2803a6b6e6f82bec0a3a2.tar.gz
podman-eb71712626f96fc0a7e2803a6b6e6f82bec0a3a2.tar.bz2
podman-eb71712626f96fc0a7e2803a6b6e6f82bec0a3a2.zip
systemd socker activation: check listener
activation.Listeners() can return an net.Listener array which contains nil entries if it cannot listen on the given fds. This can cause podman to panic so we should check the we have non nil net.Listener first. [NO NEW TESTS NEEDED] No idea how to reproduce this. Fixes #13911 Signed-off-by: Paul Holzinger <pholzing@redhat.com>
Diffstat (limited to 'pkg')
-rw-r--r--pkg/api/server/server.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/pkg/api/server/server.go b/pkg/api/server/server.go
index 9344101ce..a906a01f1 100644
--- a/pkg/api/server/server.go
+++ b/pkg/api/server/server.go
@@ -79,6 +79,10 @@ func newServer(runtime *libpod.Runtime, listener net.Listener, opts entities.Ser
return nil, fmt.Errorf("wrong number of file descriptors for socket activation protocol (%d != 1)", len(listeners))
}
listener = listeners[0]
+ // note that activation.Listeners() return nil when it cannot listen on the fd (i.e. udp connection)
+ if listener == nil {
+ return nil, fmt.Errorf("unexpected fd received from systemd: cannot listen on it")
+ }
}
if opts.CorsHeaders == "" {
logrus.Debug("CORS Headers were not set")