diff --git a/net/core/sock.c b/net/core/sock.c index f67a3c5b0988..b969d2210656 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -1893,8 +1893,16 @@ int sk_getsockopt(struct sock *sk, int level, int optname, pidfd = pidfd_prepare(peer_pid, 0, &pidfd_file); put_pid(peer_pid); - if (pidfd < 0) + if (pidfd < 0) { + /* + * dbus-broker relies on -EINVAL being returned + * to indicate ESRCH. Paper over it until this + * is fixed in userspace. + */ + if (pidfd == -ESRCH) + pidfd = -EINVAL; return pidfd; + } if (copy_to_sockptr(optval, &pidfd, len) || copy_to_sockptr(optlen, &len, sizeof(int))) {