Commit 1da8c681 authored by Willem de Bruijn's avatar Willem de Bruijn Committed by David S. Miller

sunrpc: do not pull udp headers on receive

Commit e6afc8ac modified the udp receive path by pulling the udp
header before queuing an skbuff onto the receive queue.

Sunrpc also calls skb_recv_datagram to dequeue an skb from a udp
socket. Modify this receive path to also no longer expect udp
headers.

Fixes: e6afc8ac ("udp: remove headers from UDP packets before queueing")
Reported-by: default avatarFranklin S Cooper Jr. <fcooper@ti.com>
Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
Tested-by: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent a6db4494
...@@ -155,7 +155,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb) ...@@ -155,7 +155,7 @@ int csum_partial_copy_to_xdr(struct xdr_buf *xdr, struct sk_buff *skb)
struct xdr_skb_reader desc; struct xdr_skb_reader desc;
desc.skb = skb; desc.skb = skb;
desc.offset = sizeof(struct udphdr); desc.offset = 0;
desc.count = skb->len - desc.offset; desc.count = skb->len - desc.offset;
if (skb_csum_unnecessary(skb)) if (skb_csum_unnecessary(skb))
......
...@@ -617,7 +617,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) ...@@ -617,7 +617,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
svsk->sk_sk->sk_stamp = skb->tstamp; svsk->sk_sk->sk_stamp = skb->tstamp;
set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); /* there may be more data... */ set_bit(XPT_DATA, &svsk->sk_xprt.xpt_flags); /* there may be more data... */
len = skb->len - sizeof(struct udphdr); len = skb->len;
rqstp->rq_arg.len = len; rqstp->rq_arg.len = len;
rqstp->rq_prot = IPPROTO_UDP; rqstp->rq_prot = IPPROTO_UDP;
...@@ -641,8 +641,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp) ...@@ -641,8 +641,7 @@ static int svc_udp_recvfrom(struct svc_rqst *rqstp)
skb_free_datagram_locked(svsk->sk_sk, skb); skb_free_datagram_locked(svsk->sk_sk, skb);
} else { } else {
/* we can use it in-place */ /* we can use it in-place */
rqstp->rq_arg.head[0].iov_base = skb->data + rqstp->rq_arg.head[0].iov_base = skb->data;
sizeof(struct udphdr);
rqstp->rq_arg.head[0].iov_len = len; rqstp->rq_arg.head[0].iov_len = len;
if (skb_checksum_complete(skb)) if (skb_checksum_complete(skb))
goto out_free; goto out_free;
......
...@@ -995,15 +995,14 @@ static void xs_udp_data_read_skb(struct rpc_xprt *xprt, ...@@ -995,15 +995,14 @@ static void xs_udp_data_read_skb(struct rpc_xprt *xprt,
u32 _xid; u32 _xid;
__be32 *xp; __be32 *xp;
repsize = skb->len - sizeof(struct udphdr); repsize = skb->len;
if (repsize < 4) { if (repsize < 4) {
dprintk("RPC: impossible RPC reply size %d!\n", repsize); dprintk("RPC: impossible RPC reply size %d!\n", repsize);
return; return;
} }
/* Copy the XID from the skb... */ /* Copy the XID from the skb... */
xp = skb_header_pointer(skb, sizeof(struct udphdr), xp = skb_header_pointer(skb, 0, sizeof(_xid), &_xid);
sizeof(_xid), &_xid);
if (xp == NULL) if (xp == NULL)
return; return;
......
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