diff options
author | Marin Hannache | 2014-03-12 16:26:24 +0100 |
---|---|---|
committer | Michael Brown | 2014-05-12 18:09:37 +0200 |
commit | 7aa69c4d0d997d995167683d18cb1e85d69e6018 (patch) | |
tree | e8ce9d4ab25922a2c971605ec050763b782789e4 /src/net/oncrpc | |
parent | [build] Fix version.o dependency upon git index (diff) | |
download | ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.tar.gz ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.tar.xz ipxe-7aa69c4d0d997d995167683d18cb1e85d69e6018.zip |
[nfs] Fix an invalid free() when loading a symlink
Signed-off-by: Marin Hannache <git@mareo.fr>
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/net/oncrpc')
-rw-r--r-- | src/net/oncrpc/nfs_open.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/net/oncrpc/nfs_open.c b/src/net/oncrpc/nfs_open.c index 349957ff..e9f5f9cf 100644 --- a/src/net/oncrpc/nfs_open.c +++ b/src/net/oncrpc/nfs_open.c @@ -145,6 +145,8 @@ static void nfs_done ( struct nfs_request *nfs, int rc ) { DBGC ( nfs, "NFS_OPEN %p completed (%s)\n", nfs, strerror ( rc ) ); + free ( nfs->filename ); + intf_shutdown ( &nfs->xfer, rc ); intf_shutdown ( &nfs->pm_intf, rc ); intf_shutdown ( &nfs->mount_intf, rc ); @@ -334,6 +336,15 @@ static int nfs_mount_deliver ( struct nfs_request *nfs, goto done; } + /* We need to strdup() nfs->filename since the code handling + * symlink resolution make the assumption that it can be + * free()ed. */ + if ( ( nfs->filename = strdup ( nfs->filename ) ) == NULL ) + { + rc = -ENOMEM; + goto err; + } + nfs->current_fh = mnt_reply.fh; nfs->nfs_state = NFS_LOOKUP; nfs_step ( nfs ); |