提交 70d4bf6d 编写于 作者: N Neil Horman 提交者: David S. Miller

drop_monitor: convert some kfree_skb call sites to consume_skb

Convert a few calls from kfree_skb to consume_skb

Noticed while I was working on dropwatch that I was detecting lots of internal
skb drops in several places.  While some are legitimate, several were not,
freeing skbs that were at the end of their life, rather than being discarded due
to an error.  This patch converts those calls sites from using kfree_skb to
consume_skb, which quiets the in-kernel drop_monitor code from detecting them as
drops.  Tested successfully by myself
Signed-off-by: NNeil Horman <nhorman@tuxdriver.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 4b706372
...@@ -407,7 +407,7 @@ static void kauditd_send_skb(struct sk_buff *skb) ...@@ -407,7 +407,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
audit_hold_skb(skb); audit_hold_skb(skb);
} else } else
/* drop the extra reference if sent ok */ /* drop the extra reference if sent ok */
kfree_skb(skb); consume_skb(skb);
} }
static int kauditd_thread(void *dummy) static int kauditd_thread(void *dummy)
......
...@@ -1076,14 +1076,15 @@ int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 pid, ...@@ -1076,14 +1076,15 @@ int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 pid,
sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list) sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list)
do_one_broadcast(sk, &info); do_one_broadcast(sk, &info);
kfree_skb(skb); consume_skb(skb);
netlink_unlock_table(); netlink_unlock_table();
kfree_skb(info.skb2); if (info.delivery_failure) {
kfree_skb(info.skb2);
if (info.delivery_failure)
return -ENOBUFS; return -ENOBUFS;
} else
consume_skb(info.skb2);
if (info.delivered) { if (info.delivered) {
if (info.congested && (allocation & __GFP_WAIT)) if (info.congested && (allocation & __GFP_WAIT))
......
...@@ -1906,7 +1906,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, ...@@ -1906,7 +1906,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
break; break;
} }
kfree_skb(skb); consume_skb(skb);
if (siocb->scm->fp) if (siocb->scm->fp)
break; break;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册