Commit 12b3359a authored by Willem de Bruijn's avatar Willem de Bruijn Committed by Khalid Elmously

ipv6: invert flowlabel sharing check in process and user mode

BugLink: https://bugs.launchpad.net/bugs/1830176

[ Upstream commit 95c16925 ]

A request for a flowlabel fails in process or user exclusive mode must
fail if the caller pid or uid does not match. Invert the test.

Previously, the test was unsafe wrt PID recycling, but indeed tested
for inequality: fl1->owner != fl->owner

Fixes: 4f82f457 ("net ip6 flowlabel: Make owner a union of struct pid* and kuid_t")
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 403eb820
...@@ -639,9 +639,9 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen) ...@@ -639,9 +639,9 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
if (fl1->share == IPV6_FL_S_EXCL || if (fl1->share == IPV6_FL_S_EXCL ||
fl1->share != fl->share || fl1->share != fl->share ||
((fl1->share == IPV6_FL_S_PROCESS) && ((fl1->share == IPV6_FL_S_PROCESS) &&
(fl1->owner.pid == fl->owner.pid)) || (fl1->owner.pid != fl->owner.pid)) ||
((fl1->share == IPV6_FL_S_USER) && ((fl1->share == IPV6_FL_S_USER) &&
uid_eq(fl1->owner.uid, fl->owner.uid))) !uid_eq(fl1->owner.uid, fl->owner.uid)))
goto release; goto release;
err = -ENOMEM; err = -ENOMEM;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment