]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
net: handle NAPI_GRO_FREE_STOLEN_HEAD case also in napi_frags_finish()
authorMichal Kubeček <mkubecek@suse.cz>
Thu, 29 Jun 2017 09:13:36 +0000 (11:13 +0200)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Fri, 11 Aug 2017 10:37:01 +0000 (12:37 +0200)
commit21d03da851fb54d46c16a68ad6ab859cd84ecbb9
tree92a4a41598f509f1d90b830bfb2c5bb475691c27
parent062fbad53b265eb3756916eae9d031e46ca17bc4
net: handle NAPI_GRO_FREE_STOLEN_HEAD case also in napi_frags_finish()

BugLink: http://bugs.launchpad.net/bugs/1705707
commit e44699d2c28067f69698ccb68dd3ddeacfebc434 upstream.

Recently I started seeing warnings about pages with refcount -1. The
problem was traced to packets being reused after their head was merged into
a GRO packet by skb_gro_receive(). While bisecting the issue pointed to
commit c21b48cc1bbf ("net: adjust skb->truesize in ___pskb_trim()") and
I have never seen it on a kernel with it reverted, I believe the real
problem appeared earlier when the option to merge head frag in GRO was
implemented.

Handling NAPI_GRO_FREE_STOLEN_HEAD state was only added to GRO_MERGED_FREE
branch of napi_skb_finish() so that if the driver uses napi_gro_frags()
and head is merged (which in my case happens after the skb_condense()
call added by the commit mentioned above), the skb is reused including the
head that has been merged. As a result, we release the page reference
twice and eventually end up with negative page refcount.

To fix the problem, handle NAPI_GRO_FREE_STOLEN_HEAD in napi_frags_finish()
the same way it's done in napi_skb_finish().

Fixes: d7e8883cfcf4 ("net: make GRO aware of skb->head_frag")
Signed-off-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
net/core/dev.c