* [PATCH net] sunrpc: fix UDP memory accounting
@ 2016-08-25 16:42 Paolo Abeni
[not found] ` <32a391a2469b4161dc2375c6b6374b8229b3dd37.1472126188.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Paolo Abeni @ 2016-08-25 16:42 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA
Cc: Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton,
David S. Miller, linux-nfs-u79uwXL29TY76Z2rM5mHXA, Jan Stancek
The commit f9b2ee714c5c ("SUNRPC: Move UDP receive data path
into a workqueue context"), as a side effect, moved the
skb_free_datagram() call outside the scope of the related socket
lock, but UDP sockets require such lock to be held for proper
memory accounting.
Fix it by replacing skb_free_datagram() with
skb_free_datagram_locked().
Fixes: f9b2ee714c5c ("SUNRPC: Move UDP receive data path into a workqueue context")
Reported-and-tested-by: Jan Stancek <jstancek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
net/sunrpc/xprtsock.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 8ede3bc..bf16883 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1074,7 +1074,7 @@ static void xs_udp_data_receive(struct sock_xprt *transport)
skb = skb_recv_datagram(sk, 0, 1, &err);
if (skb != NULL) {
xs_udp_data_read_skb(&transport->xprt, sk, skb);
- skb_free_datagram(sk, skb);
+ skb_free_datagram_locked(sk, skb);
continue;
}
if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, &transport->sock_state))
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <32a391a2469b4161dc2375c6b6374b8229b3dd37.1472126188.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH net] sunrpc: fix UDP memory accounting [not found] ` <32a391a2469b4161dc2375c6b6374b8229b3dd37.1472126188.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-08-30 16:28 ` Benjamin Coddington [not found] ` <F9224521-4FC7-4647-8BB8-C92A841EE23D-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Benjamin Coddington @ 2016-08-30 16:28 UTC (permalink / raw) To: Paolo Abeni Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton, David S. Miller, linux-nfs-u79uwXL29TY76Z2rM5mHXA, Jan Stancek On 25 Aug 2016, at 12:42, Paolo Abeni wrote: > The commit f9b2ee714c5c ("SUNRPC: Move UDP receive data path > into a workqueue context"), as a side effect, moved the > skb_free_datagram() call outside the scope of the related socket > lock, but UDP sockets require such lock to be held for proper > memory accounting. > Fix it by replacing skb_free_datagram() with > skb_free_datagram_locked(). > > Fixes: f9b2ee714c5c ("SUNRPC: Move UDP receive data path into a > workqueue context") > Reported-and-tested-by: Jan Stancek <jstancek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > Signed-off-by: Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Thanks for finding this. A similar fix in 2009 for svcsock.c was done by Eric Dumazet: 9d410c796067 ("net: fix sk_forward_alloc corruption") skb_free_datagram_locked() is used for all xprt types in svcsock.c, should we use it for the xs_local_transport as well in xprtsock.c? Ben > --- > net/sunrpc/xprtsock.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c > index 8ede3bc..bf16883 100644 > --- a/net/sunrpc/xprtsock.c > +++ b/net/sunrpc/xprtsock.c > @@ -1074,7 +1074,7 @@ static void xs_udp_data_receive(struct sock_xprt > *transport) > skb = skb_recv_datagram(sk, 0, 1, &err); > if (skb != NULL) { > xs_udp_data_read_skb(&transport->xprt, sk, skb); > - skb_free_datagram(sk, skb); > + skb_free_datagram_locked(sk, skb); > continue; > } > if (!test_and_clear_bit(XPRT_SOCK_DATA_READY, > &transport->sock_state)) > -- > 1.8.3.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-nfs" > in > the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <F9224521-4FC7-4647-8BB8-C92A841EE23D-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH net] sunrpc: fix UDP memory accounting [not found] ` <F9224521-4FC7-4647-8BB8-C92A841EE23D-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-08-31 11:45 ` Paolo Abeni [not found] ` <1472643951.4775.6.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> 0 siblings, 1 reply; 4+ messages in thread From: Paolo Abeni @ 2016-08-31 11:45 UTC (permalink / raw) To: Benjamin Coddington Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton, David S. Miller, linux-nfs-u79uwXL29TY76Z2rM5mHXA, Jan Stancek On Tue, 2016-08-30 at 12:28 -0400, Benjamin Coddington wrote: > On 25 Aug 2016, at 12:42, Paolo Abeni wrote: > > > The commit f9b2ee714c5c ("SUNRPC: Move UDP receive data path > > into a workqueue context"), as a side effect, moved the > > skb_free_datagram() call outside the scope of the related socket > > lock, but UDP sockets require such lock to be held for proper > > memory accounting. > > Fix it by replacing skb_free_datagram() with > > skb_free_datagram_locked(). > > > > Fixes: f9b2ee714c5c ("SUNRPC: Move UDP receive data path into a > > workqueue context") > > Reported-and-tested-by: Jan Stancek <jstancek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > > Signed-off-by: Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> > > Thanks for finding this. A similar fix in 2009 for svcsock.c was done by > Eric Dumazet: > 9d410c796067 ("net: fix sk_forward_alloc corruption") > > skb_free_datagram_locked() is used for all xprt types in svcsock.c, > should we use > it for the xs_local_transport as well in xprtsock.c? AFAICS a similar fix is _not_ needed for xs_local_transport(), since it uses AF_LOCAL sockets and such family does not support protocol's memory accounting. Paolo -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <1472643951.4775.6.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH net] sunrpc: fix UDP memory accounting [not found] ` <1472643951.4775.6.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> @ 2016-08-31 11:59 ` Benjamin Coddington 0 siblings, 0 replies; 4+ messages in thread From: Benjamin Coddington @ 2016-08-31 11:59 UTC (permalink / raw) To: Paolo Abeni Cc: netdev-u79uwXL29TY76Z2rM5mHXA, Trond Myklebust, Anna Schumaker, J. Bruce Fields, Jeff Layton, David S. Miller, linux-nfs-u79uwXL29TY76Z2rM5mHXA, Jan Stancek On 31 Aug 2016, at 7:45, Paolo Abeni wrote: > On Tue, 2016-08-30 at 12:28 -0400, Benjamin Coddington wrote: >> On 25 Aug 2016, at 12:42, Paolo Abeni wrote: >> >>> The commit f9b2ee714c5c ("SUNRPC: Move UDP receive data path >>> into a workqueue context"), as a side effect, moved the >>> skb_free_datagram() call outside the scope of the related socket >>> lock, but UDP sockets require such lock to be held for proper >>> memory accounting. >>> Fix it by replacing skb_free_datagram() with >>> skb_free_datagram_locked(). >>> >>> Fixes: f9b2ee714c5c ("SUNRPC: Move UDP receive data path into a >>> workqueue context") >>> Reported-and-tested-by: Jan Stancek <jstancek-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >>> Signed-off-by: Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> >> >> Thanks for finding this. A similar fix in 2009 for svcsock.c was done by >> Eric Dumazet: >> 9d410c796067 ("net: fix sk_forward_alloc corruption") >> >> skb_free_datagram_locked() is used for all xprt types in svcsock.c, >> should we use >> it for the xs_local_transport as well in xprtsock.c? > > AFAICS a similar fix is _not_ needed for xs_local_transport(), since it > uses AF_LOCAL sockets and such family does not support protocol's memory > accounting. This fixes the WARNING reported by Jan Stancek here: http://marc.info/?l=linux-nfs&m=146616830928019&w=2 Reviewed-by: Benjamin Coddington <bcodding-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> Ben -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-31 11:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-25 16:42 [PATCH net] sunrpc: fix UDP memory accounting Paolo Abeni
[not found] ` <32a391a2469b4161dc2375c6b6374b8229b3dd37.1472126188.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-30 16:28 ` Benjamin Coddington
[not found] ` <F9224521-4FC7-4647-8BB8-C92A841EE23D-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-31 11:45 ` Paolo Abeni
[not found] ` <1472643951.4775.6.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-08-31 11:59 ` Benjamin Coddington
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox