Merge branch 'net-zerocopy-fixes'

Willem de Bruijn says:

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

Fix two issues introduced in the msg_zerocopy patchset.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
David S. Miller 2017-08-09 16:49:17 -07:00
commit 0bdf7101c6
2 changed files with 9 additions and 4 deletions

View File

@ -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;
} }
} }

View File

@ -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);
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