diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-04-04 20:55:34 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2014-04-04 20:57:29 +0200 |
commit | 58f78ea0c81a106cb2b9220eb9290bef15466cd9 (patch) | |
tree | c14eca5c9a28a41522720aed96359da2418c1358 /libdiskfs | |
parent | 64b5d358fcaa039ca2e7634aceaa5ed4c3a10cc4 (diff) |
Fix spurious unlock on error
Thanks Cyril Roelandt for finding the issue.
* libdiskfs/dir-renamed.c (diskfs_rename_dir): On diskfs_lookup error,
set fnp to NULL to avoid unlocking it spuriously.
Diffstat (limited to 'libdiskfs')
-rw-r--r-- | libdiskfs/dir-renamed.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libdiskfs/dir-renamed.c b/libdiskfs/dir-renamed.c index 9b7ec3a6..9e37e234 100644 --- a/libdiskfs/dir-renamed.c +++ b/libdiskfs/dir-renamed.c @@ -209,7 +209,12 @@ diskfs_rename_dir (struct node *fdp, struct node *fnp, const char *fromname, if (tmpnp) diskfs_nrele (tmpnp); if (err) - goto out; + { + assert (!tmpnp); + /* diskfs_lookup has not locked fnp then, do not unlock it. */ + fnp = NULL; + goto out; + } diskfs_dirremove (fdp, fnp, fromname, ds); ds = 0; |