From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 4/8] nfs: Fix rpc_check_reply() return value for stale packets
Date: Mon, 30 Mar 2020 11:12:06 +0200 [thread overview]
Message-ID: <20200330091210.18716-5-s.hauer@pengutronix.de> (raw)
In-Reply-To: <20200330091210.18716-1-s.hauer@pengutronix.de>
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>
---
fs/nfs.c | 9 ++-------
1 file 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 ||
--
2.26.0.rc2
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2020-03-30 9:12 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-30 9:12 [PATCH 0/8] NFS fixes Sascha Hauer
2020-03-30 9:12 ` [PATCH 1/8] nfs: Add function to free packets Sascha Hauer
2020-03-30 9:12 ` [PATCH 2/8] nfs: Add missing free Sascha Hauer
2020-03-30 9:12 ` [PATCH 3/8] nfs: remove unnecessary check Sascha Hauer
2020-03-30 9:12 ` Sascha Hauer [this message]
2020-03-30 9:12 ` [PATCH 5/8] nfs: Fix polling for packets Sascha Hauer
2020-03-30 9:12 ` [PATCH 6/8] nfs: queue received packets Sascha Hauer
2020-03-30 9:12 ` [PATCH 7/8] fs: nfs: don't maintain nfs dentries in dcache Sascha Hauer
2020-03-30 9:12 ` [PATCH 8/8] nfs: Do not allow to abort Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200330091210.18716-5-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox