mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
[TCP]: Restore SKB socket owner setting in tcp_transmit_skb().
Revert 931731123a
We can't elide the skb_set_owner_w() here because things like certain
netfilter targets (such as owner MATCH) need a socket to be set on the
SKB for correct operation.
Thanks to Jan Engelhardt and other netfilter list members for
pointing this out.
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
d5e76b0a28
commit
e89862f4c5
@ -38,5 +38,5 @@ extern void inet6_csk_reqsk_queue_hash_add(struct sock *sk,
|
|||||||
|
|
||||||
extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
|
extern void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr *uaddr);
|
||||||
|
|
||||||
extern int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
|
extern int inet6_csk_xmit(struct sk_buff *skb, int ipfragok);
|
||||||
#endif /* _INET6_CONNECTION_SOCK_H */
|
#endif /* _INET6_CONNECTION_SOCK_H */
|
||||||
|
@ -37,8 +37,7 @@ struct tcp_congestion_ops;
|
|||||||
* (i.e. things that depend on the address family)
|
* (i.e. things that depend on the address family)
|
||||||
*/
|
*/
|
||||||
struct inet_connection_sock_af_ops {
|
struct inet_connection_sock_af_ops {
|
||||||
int (*queue_xmit)(struct sk_buff *skb, struct sock *sk,
|
int (*queue_xmit)(struct sk_buff *skb, int ipfragok);
|
||||||
int ipfragok);
|
|
||||||
void (*send_check)(struct sock *sk, int len,
|
void (*send_check)(struct sock *sk, int len,
|
||||||
struct sk_buff *skb);
|
struct sk_buff *skb);
|
||||||
int (*rebuild_header)(struct sock *sk);
|
int (*rebuild_header)(struct sock *sk);
|
||||||
|
@ -97,7 +97,7 @@ extern int ip_mc_output(struct sk_buff *skb);
|
|||||||
extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
|
extern int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *));
|
||||||
extern int ip_do_nat(struct sk_buff *skb);
|
extern int ip_do_nat(struct sk_buff *skb);
|
||||||
extern void ip_send_check(struct iphdr *ip);
|
extern void ip_send_check(struct iphdr *ip);
|
||||||
extern int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok);
|
extern int ip_queue_xmit(struct sk_buff *skb, int ipfragok);
|
||||||
extern void ip_init(void);
|
extern void ip_init(void);
|
||||||
extern int ip_append_data(struct sock *sk,
|
extern int ip_append_data(struct sock *sk,
|
||||||
int getfrag(void *from, char *to, int offset, int len,
|
int getfrag(void *from, char *to, int offset, int len,
|
||||||
|
@ -124,7 +124,7 @@ static int dccp_transmit_skb(struct sock *sk, struct sk_buff *skb)
|
|||||||
DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
|
DCCP_INC_STATS(DCCP_MIB_OUTSEGS);
|
||||||
|
|
||||||
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
||||||
err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0);
|
err = icsk->icsk_af_ops->queue_xmit(skb, 0);
|
||||||
return net_xmit_eval(err);
|
return net_xmit_eval(err);
|
||||||
}
|
}
|
||||||
return -ENOBUFS;
|
return -ENOBUFS;
|
||||||
@ -396,7 +396,7 @@ int dccp_send_reset(struct sock *sk, enum dccp_reset_codes code)
|
|||||||
code);
|
code);
|
||||||
if (skb != NULL) {
|
if (skb != NULL) {
|
||||||
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
memset(&(IPCB(skb)->opt), 0, sizeof(IPCB(skb)->opt));
|
||||||
err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, sk, 0);
|
err = inet_csk(sk)->icsk_af_ops->queue_xmit(skb, 0);
|
||||||
return net_xmit_eval(err);
|
return net_xmit_eval(err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -281,8 +281,9 @@ int ip_output(struct sk_buff *skb)
|
|||||||
!(IPCB(skb)->flags & IPSKB_REROUTED));
|
!(IPCB(skb)->flags & IPSKB_REROUTED));
|
||||||
}
|
}
|
||||||
|
|
||||||
int ip_queue_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok)
|
int ip_queue_xmit(struct sk_buff *skb, int ipfragok)
|
||||||
{
|
{
|
||||||
|
struct sock *sk = skb->sk;
|
||||||
struct inet_sock *inet = inet_sk(sk);
|
struct inet_sock *inet = inet_sk(sk);
|
||||||
struct ip_options *opt = inet->opt;
|
struct ip_options *opt = inet->opt;
|
||||||
struct rtable *rt;
|
struct rtable *rt;
|
||||||
|
@ -467,6 +467,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
|
|||||||
|
|
||||||
th = (struct tcphdr *) skb_push(skb, tcp_header_size);
|
th = (struct tcphdr *) skb_push(skb, tcp_header_size);
|
||||||
skb->h.th = th;
|
skb->h.th = th;
|
||||||
|
skb_set_owner_w(skb, sk);
|
||||||
|
|
||||||
/* Build TCP header and checksum it. */
|
/* Build TCP header and checksum it. */
|
||||||
th->source = inet->sport;
|
th->source = inet->sport;
|
||||||
@ -540,7 +541,7 @@ static int tcp_transmit_skb(struct sock *sk, struct sk_buff *skb, int clone_it,
|
|||||||
if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq)
|
if (after(tcb->end_seq, tp->snd_nxt) || tcb->seq == tcb->end_seq)
|
||||||
TCP_INC_STATS(TCP_MIB_OUTSEGS);
|
TCP_INC_STATS(TCP_MIB_OUTSEGS);
|
||||||
|
|
||||||
err = icsk->icsk_af_ops->queue_xmit(skb, sk, 0);
|
err = icsk->icsk_af_ops->queue_xmit(skb, 0);
|
||||||
if (likely(err <= 0))
|
if (likely(err <= 0))
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -139,8 +139,9 @@ void inet6_csk_addr2sockaddr(struct sock *sk, struct sockaddr * uaddr)
|
|||||||
|
|
||||||
EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr);
|
EXPORT_SYMBOL_GPL(inet6_csk_addr2sockaddr);
|
||||||
|
|
||||||
int inet6_csk_xmit(struct sk_buff *skb, struct sock *sk, int ipfragok)
|
int inet6_csk_xmit(struct sk_buff *skb, int ipfragok)
|
||||||
{
|
{
|
||||||
|
struct sock *sk = skb->sk;
|
||||||
struct inet_sock *inet = inet_sk(sk);
|
struct inet_sock *inet = inet_sk(sk);
|
||||||
struct ipv6_pinfo *np = inet6_sk(sk);
|
struct ipv6_pinfo *np = inet6_sk(sk);
|
||||||
struct flowi fl;
|
struct flowi fl;
|
||||||
|
@ -804,7 +804,7 @@ static inline int sctp_v4_xmit(struct sk_buff *skb,
|
|||||||
NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
|
NIPQUAD(((struct rtable *)skb->dst)->rt_dst));
|
||||||
|
|
||||||
SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
|
SCTP_INC_STATS(SCTP_MIB_OUTSCTPPACKS);
|
||||||
return ip_queue_xmit(skb, skb->sk, ipfragok);
|
return ip_queue_xmit(skb, ipfragok);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct sctp_af sctp_ipv4_specific;
|
static struct sctp_af sctp_ipv4_specific;
|
||||||
|
Loading…
Reference in New Issue
Block a user