Commit 0bdf7101 authored by David S. Miller's avatar David S. Miller

Merge branch 'net-zerocopy-fixes'

Willem de Bruijn says:

====================
net: zerocopy fixes

Fix two issues introduced in the msg_zerocopy patchset.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents d5e7f827 0a4a060b
...@@ -1273,8 +1273,13 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) ...@@ -1273,8 +1273,13 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy)
struct ubuf_info *uarg = skb_zcopy(skb); struct ubuf_info *uarg = skb_zcopy(skb);
if (uarg) { if (uarg) {
uarg->zerocopy = uarg->zerocopy && zerocopy; if (uarg->callback == sock_zerocopy_callback) {
sock_zerocopy_put(uarg); uarg->zerocopy = uarg->zerocopy && zerocopy;
sock_zerocopy_put(uarg);
} else {
uarg->callback(uarg, zerocopy);
}
skb_shinfo(skb)->tx_flags &= ~SKBTX_ZEROCOPY_FRAG; skb_shinfo(skb)->tx_flags &= ~SKBTX_ZEROCOPY_FRAG;
} }
} }
......
...@@ -1044,6 +1044,8 @@ void sock_zerocopy_callback(struct ubuf_info *uarg, bool success) ...@@ -1044,6 +1044,8 @@ void sock_zerocopy_callback(struct ubuf_info *uarg, bool success)
u32 lo, hi; u32 lo, hi;
u16 len; u16 len;
mm_unaccount_pinned_pages(&uarg->mmp);
/* if !len, there was only 1 call, and it was aborted /* if !len, there was only 1 call, and it was aborted
* so do not queue a completion notification * so do not queue a completion notification
*/ */
...@@ -1084,8 +1086,6 @@ EXPORT_SYMBOL_GPL(sock_zerocopy_callback); ...@@ -1084,8 +1086,6 @@ EXPORT_SYMBOL_GPL(sock_zerocopy_callback);
void sock_zerocopy_put(struct ubuf_info *uarg) void sock_zerocopy_put(struct ubuf_info *uarg)
{ {
if (uarg && atomic_dec_and_test(&uarg->refcnt)) { if (uarg && atomic_dec_and_test(&uarg->refcnt)) {
mm_unaccount_pinned_pages(&uarg->mmp);
if (uarg->callback) if (uarg->callback)
uarg->callback(uarg, uarg->zerocopy); uarg->callback(uarg, uarg->zerocopy);
else else
......
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