Skip to content

Commit 3a7c384

Browse files
Eric Dumazetdavem330
Eric Dumazet
authored andcommitted
ipv4: tcp: unicast_sock should not land outside of TCP stack
commit be9f4a4 (ipv4: tcp: remove per net tcp_sock) added a selinux regression, reported and bisected by John Stultz selinux_ip_postroute_compat() expect to find a valid sk->sk_security pointer, but this field is NULL for unicast_sock It turns out that unicast_sock are really temporary stuff to be able to reuse part of IP stack (ip_append_data()/ip_push_pending_frames()) Fact is that frames sent by ip_send_unicast_reply() should be orphaned to not fool LSM. Note IPv6 never had this problem, as tcp_v6_send_response() doesnt use a fake socket at all. I'll probably implement tcp_v4_send_response() to remove these unicast_sock in linux-3.7 Reported-by: John Stultz <[email protected]> Bisected-by: John Stultz <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Cc: Paul Moore <[email protected]> Cc: Eric Paris <[email protected]> Cc: "Serge E. Hallyn" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2070ffa commit 3a7c384

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

net/ipv4/ip_output.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,7 @@ void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr,
15361536
arg->csumoffset) = csum_fold(csum_add(nskb->csum,
15371537
arg->csum));
15381538
nskb->ip_summed = CHECKSUM_NONE;
1539+
skb_orphan(nskb);
15391540
skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb));
15401541
ip_push_pending_frames(sk, &fl4);
15411542
}

0 commit comments

Comments
 (0)