From a5521b6b70ab197259bd048c1d39eaef962f383c Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Mon, 16 May 2011 15:02:14 -0500 Subject: [PATCH] viced: Check vnode length on Rename and Link Commit 2578555d7e08131bf2fe4cdd0aa4b32567a76eb2 added vnode length checks when we create or remove vnodes, but not during Rename and Link operations (when vnodes are neither created nor destroyed). Add the check in Rename and Link. Reviewed-on: http://gerrit.openafs.org/4668 Tested-by: BuildBot Reviewed-by: Derrick Brashear (cherry picked from commit 6df5547a7b93af74bc49ec8d4678aafd646dda1b) Change-Id: I795407a143a56f26c0679b929763ebdc9c633e7a Reviewed-on: http://gerrit.openafs.org/6298 Tested-by: Derrick Brashear Reviewed-by: Derrick Brashear --- src/viced/afsfileprocs.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/viced/afsfileprocs.c b/src/viced/afsfileprocs.c index b7319b8df..9238654b1 100644 --- a/src/viced/afsfileprocs.c +++ b/src/viced/afsfileprocs.c @@ -3980,6 +3980,13 @@ SAFSS_Rename(struct rx_call *acall, struct AFSFid *OldDirFid, char *OldName, goto Bad_Rename; } + if (CheckLength(volptr, oldvptr, -1) || + CheckLength(volptr, newvptr, -1)) { + VTakeOffline(volptr); + errorCode = VSALVAGE; + goto Bad_Rename; + } + /* The CopyOnWrite might return ENOSPC ( disk full). Even if the second * call to CopyOnWrite returns error, it is not necessary to revert back * the effects of the first call because the contents of the volume is @@ -4673,6 +4680,12 @@ SAFSS_Link(struct rx_call *acall, struct AFSFid *DirFid, char *Name, goto Bad_Link; } + if (CheckLength(volptr, parentptr, -1)) { + VTakeOffline(volptr); + errorCode = VSALVAGE; + goto Bad_Link; + } + /* get the file vnode */ if ((errorCode = CheckVnode(ExistingFid, &volptr, &targetptr, WRITE_LOCK))) { -- 2.39.5