volser: Close dirp on error in ConvertROtoRW 42/14342/3
authorMarcio Barbosa <mbarbosa@sinenomine.net>
Thu, 3 Sep 2020 20:11:34 +0000 (20:11 +0000)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 23 Oct 2020 16:16:07 +0000 (12:16 -0400)
Currently, if SAFSVolConvertROtoRWvolume cannot create a new transaction
for the volume to be converted, it returns without closing the directory
stream opened by it. To prevent this leak, go through a new 'goto done'
destructor if NewTrans fails.

Change-Id: Ie0580e7739ae667f1cd2f9cabb8aaf5e15d3f2dd
Reviewed-on: https://gerrit.openafs.org/14342
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/volser/volprocs.c

index 13bba38..3b43316 100644 (file)
@@ -2994,7 +2994,8 @@ SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId,
 #endif
             ttc = NewTrans(volumeId, partId);
             if (!ttc) {
-               return VOLSERVOLBUSY;
+               ret = VOLSERVOLBUSY;
+               goto done;
             }
 #ifdef AFS_NAMEI_ENV
            ret = namei_ConvertROtoRWvolume(pname, volumeId);
@@ -3004,7 +3005,7 @@ SAFSVolConvertROtoRWvolume(struct rx_call *acid, afs_int32 partId,
            break;
        }
     }
-
+  done:
     if (ttc)
         DeleteTrans(ttc, 1);