netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH netfilter] netfilter: xt_owner: use sk->sk_uid for owner lookup
@ 2021-12-23  7:06 Maciej Żenczykowski
  2021-12-23 10:35 ` Jan Engelhardt
  0 siblings, 1 reply; 3+ messages in thread
From: Maciej Żenczykowski @ 2021-12-23  7:06 UTC (permalink / raw)
  To: Maciej Żenczykowski, Pablo Neira Ayuso, Florian Westphal
  Cc: Linux Network Development Mailing List,
	Netfilter Development Mailing List, Lorenzo Colitti

From: Maciej Żenczykowski <maze@google.com>

this makes fchown() affect '-m owner --uid-owner'

Cc: Lorenzo Colitti <lorenzo@google.com>
Fixes: 86741ec25462 ('net: core: Add a UID field to struct sock.')
Signed-off-by: Maciej Żenczykowski <maze@google.com>
---
 net/netfilter/xt_owner.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/netfilter/xt_owner.c b/net/netfilter/xt_owner.c
index e85ce69924ae..3eebd9c7ea4b 100644
--- a/net/netfilter/xt_owner.c
+++ b/net/netfilter/xt_owner.c
@@ -84,8 +84,8 @@ owner_mt(const struct sk_buff *skb, struct xt_action_param *par)
 	if (info->match & XT_OWNER_UID) {
 		kuid_t uid_min = make_kuid(net->user_ns, info->uid_min);
 		kuid_t uid_max = make_kuid(net->user_ns, info->uid_max);
-		if ((uid_gte(filp->f_cred->fsuid, uid_min) &&
-		     uid_lte(filp->f_cred->fsuid, uid_max)) ^
+		if ((uid_gte(sk->sk_uid, uid_min) &&
+		     uid_lte(sk->sk_uid, uid_max)) ^
 		    !(info->invert & XT_OWNER_UID))
 			return false;
 	}
-- 
2.34.1.307.g9b7440fafd-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-12-23 18:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-23  7:06 [PATCH netfilter] netfilter: xt_owner: use sk->sk_uid for owner lookup Maciej Żenczykowski
2021-12-23 10:35 ` Jan Engelhardt
2021-12-23 18:36   ` Maciej Żenczykowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).