summaryrefslogtreecommitdiff
path: root/fs/nfs.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2020-03-30 10:24:50 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2020-03-30 11:08:46 +0200
commitd8d36e5682dc9f2fefffb7a938915d67bb1be223 (patch)
treec1589ccd68eb40872a641a101a60206d21803922 /fs/nfs.c
parentfc951ebcbbff9fc415381072fbac3af406a776ce (diff)
downloadbarebox-d8d36e5682dc9f2fefffb7a938915d67bb1be223.tar.gz
nfs: Fix rpc_check_reply() return value for stale packets
When we receive a packet with the previous rpc_id then we have the comment "stale packet, wait a bit longer", but that's not what the code does. rpc_check_reply() returns 0 in this case and the caller then interprets the packet as valid. Always return -EAGAIN for invalid rpc_ids. This lets the caller ignore the packets as intented. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/nfs.c')
-rw-r--r--fs/nfs.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/fs/nfs.c b/fs/nfs.c
index 9956791820..1bfd36fcb6 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -368,13 +368,8 @@ static int rpc_check_reply(struct packet *pkt, int rpc_prog,
memcpy(&rpc, pkt->data, sizeof(rpc));
- if (ntoh32(rpc.id) != rpc_id) {
- if (rpc_id - ntoh32(rpc.id) == 1)
- /* stale packet, wait a bit longer */
- return 0;
-
- return -EINVAL;
- }
+ if (ntoh32(rpc.id) != rpc_id)
+ return -EAGAIN;
if (rpc.rstatus ||
rpc.verifier ||