Commit 743b2a66 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

sched: cls_flow: use skb_to_full_sk() helper

SYNACK packets might be attached to request sockets.

Fixes: ca6fb065 ("tcp: attach SYNACK messages to request sockets instead of listener")
Signed-off-by: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fdd723e2
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/if_vlan.h> #include <linux/if_vlan.h>
#include <linux/slab.h> #include <linux/slab.h>
#include <linux/module.h> #include <linux/module.h>
#include <net/inet_sock.h>
#include <net/pkt_cls.h> #include <net/pkt_cls.h>
#include <net/ip.h> #include <net/ip.h>
...@@ -197,8 +198,11 @@ static u32 flow_get_rtclassid(const struct sk_buff *skb) ...@@ -197,8 +198,11 @@ static u32 flow_get_rtclassid(const struct sk_buff *skb)
static u32 flow_get_skuid(const struct sk_buff *skb) static u32 flow_get_skuid(const struct sk_buff *skb)
{ {
if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) { struct sock *sk = skb_to_full_sk(skb);
kuid_t skuid = skb->sk->sk_socket->file->f_cred->fsuid;
if (sk && sk->sk_socket && sk->sk_socket->file) {
kuid_t skuid = sk->sk_socket->file->f_cred->fsuid;
return from_kuid(&init_user_ns, skuid); return from_kuid(&init_user_ns, skuid);
} }
return 0; return 0;
...@@ -206,8 +210,11 @@ static u32 flow_get_skuid(const struct sk_buff *skb) ...@@ -206,8 +210,11 @@ static u32 flow_get_skuid(const struct sk_buff *skb)
static u32 flow_get_skgid(const struct sk_buff *skb) static u32 flow_get_skgid(const struct sk_buff *skb)
{ {
if (skb->sk && skb->sk->sk_socket && skb->sk->sk_socket->file) { struct sock *sk = skb_to_full_sk(skb);
kgid_t skgid = skb->sk->sk_socket->file->f_cred->fsgid;
if (sk && sk->sk_socket && sk->sk_socket->file) {
kgid_t skgid = sk->sk_socket->file->f_cred->fsgid;
return from_kgid(&init_user_ns, skgid); return from_kgid(&init_user_ns, skgid);
} }
return 0; return 0;
......
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