aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/skbuff.h8
-rw-r--r--net/ipv4/tcp_output.c2
-rw-r--r--net/xfrm/xfrm_policy.c2
3 files changed, 8 insertions, 4 deletions
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 5884f95ff0e9..6c8b6f604e76 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -799,15 +799,19 @@ struct sk_buff_fclones {
799 * @skb: buffer 799 * @skb: buffer
800 * 800 *
801 * Returns true is skb is a fast clone, and its clone is not freed. 801 * Returns true is skb is a fast clone, and its clone is not freed.
802 * Some drivers call skb_orphan() in their ndo_start_xmit(),
803 * so we also check that this didnt happen.
802 */ 804 */
803static inline bool skb_fclone_busy(const struct sk_buff *skb) 805static inline bool skb_fclone_busy(const struct sock *sk,
806 const struct sk_buff *skb)
804{ 807{
805 const struct sk_buff_fclones *fclones; 808 const struct sk_buff_fclones *fclones;
806 809
807 fclones = container_of(skb, struct sk_buff_fclones, skb1); 810 fclones = container_of(skb, struct sk_buff_fclones, skb1);
808 811
809 return skb->fclone == SKB_FCLONE_ORIG && 812 return skb->fclone == SKB_FCLONE_ORIG &&
810 fclones->skb2.fclone == SKB_FCLONE_CLONE; 813 fclones->skb2.fclone == SKB_FCLONE_CLONE &&
814 fclones->skb2.sk == sk;
811} 815}
812 816
813static inline struct sk_buff *alloc_skb_fclone(unsigned int size, 817static inline struct sk_buff *alloc_skb_fclone(unsigned int size,
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 3af21296d967..a3d453b94747 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2126,7 +2126,7 @@ bool tcp_schedule_loss_probe(struct sock *sk)
2126static bool skb_still_in_host_queue(const struct sock *sk, 2126static bool skb_still_in_host_queue(const struct sock *sk,
2127 const struct sk_buff *skb) 2127 const struct sk_buff *skb)
2128{ 2128{
2129 if (unlikely(skb_fclone_busy(skb))) { 2129 if (unlikely(skb_fclone_busy(sk, skb))) {
2130 NET_INC_STATS_BH(sock_net(sk), 2130 NET_INC_STATS_BH(sock_net(sk),
2131 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES); 2131 LINUX_MIB_TCPSPURIOUS_RTX_HOSTQUEUES);
2132 return true; 2132 return true;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 4c4e457e7888..88bf289abdc9 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1962,7 +1962,7 @@ static int xdst_queue_output(struct sock *sk, struct sk_buff *skb)
1962 struct xfrm_policy *pol = xdst->pols[0]; 1962 struct xfrm_policy *pol = xdst->pols[0];
1963 struct xfrm_policy_queue *pq = &pol->polq; 1963 struct xfrm_policy_queue *pq = &pol->polq;
1964 1964
1965 if (unlikely(skb_fclone_busy(skb))) { 1965 if (unlikely(skb_fclone_busy(sk, skb))) {
1966 kfree_skb(skb); 1966 kfree_skb(skb);
1967 return 0; 1967 return 0;
1968 } 1968 }