Skip to content

Commit 95c1692

Browse files
wdebruijdavem330
authored andcommitted
ipv6: invert flowlabel sharing check in process and user mode
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: 4f82f45 ("net ip6 flowlabel: Make owner a union of struct pid* and kuid_t") Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6ee12b7 commit 95c1692

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/ipv6/ip6_flowlabel.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -633,9 +633,9 @@ int ipv6_flowlabel_opt(struct sock *sk, char __user *optval, int optlen)
633633
if (fl1->share == IPV6_FL_S_EXCL ||
634634
fl1->share != fl->share ||
635635
((fl1->share == IPV6_FL_S_PROCESS) &&
636-
(fl1->owner.pid == fl->owner.pid)) ||
636+
(fl1->owner.pid != fl->owner.pid)) ||
637637
((fl1->share == IPV6_FL_S_USER) &&
638-
uid_eq(fl1->owner.uid, fl->owner.uid)))
638+
!uid_eq(fl1->owner.uid, fl->owner.uid)))
639639
goto release;
640640

641641
err = -ENOMEM;

0 commit comments

Comments
 (0)