diff options
author | Uwe Kleine-König <u.kleine-koenig@pengutronix.de> | 2019-01-21 12:27:30 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2019-01-22 08:25:25 +0100 |
commit | 9d929c6f4b5ed7d9b7be7ef874c8523a52719c81 (patch) | |
tree | 71af57d3c0517bee2c4a3fbf98281f9e79a79a5f /fs/nfs.c | |
parent | 25082eff77300372316fe85265730d1d3e653287 (diff) | |
download | barebox-9d929c6f4b5ed7d9b7be7ef874c8523a52719c81.tar.gz barebox-9d929c6f4b5ed7d9b7be7ef874c8523a52719c81.tar.xz |
fs/nfs: don't try to set nfs error code from mount rpc call
A packet from a mount rpc call doesn't have an NFS error field, so don't
try to access this.
In the case of the MOUNT_UMOUNT procedure the reply package is short
such that accessing the u32 after the rpc_reply structure is already
after the end of the packet. Apart from the access to out-of-packet data
there is no harm because the wrongly read value is unused. But make this
more explicit by only using nfserr if the call was an NFS request.
Fixes: 9ede56ad2476 ("fs: Add NFS support")
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'fs/nfs.c')
-rw-r--r-- | fs/nfs.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -382,7 +382,7 @@ static int rpc_check_reply(unsigned char *pkt, return -EINVAL; } - if (rpc_prog == PROG_PORTMAP) + if (rpc_prog != PROG_NFS) return 0; data = (uint32_t *)(pkt + sizeof(struct rpc_reply)); @@ -459,7 +459,8 @@ again: ret = rpc_check_reply(nfs_packet, rpc_prog, npriv->rpc_id, &nfserr); if (!ret) { - ret = nfserr; + if (rpc_prog == PROG_NFS) + ret = nfserr; break; } } |