From: Michael Meffie Date: Sat, 28 Apr 2018 02:59:57 +0000 (-0400) Subject: vol: check for bad partition names X-Git-Tag: upstream/1.8.1_pre2^2~30 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=1962edf361341df0b842cd749493026a4540cc7a;p=packages%2Fo%2Fopenafs.git vol: check for bad partition names Currently, servers attempt to attach any partition name starting with "/vicep", even partition names which map to out of range partition ids. Examples of such misnamed partitions are "/vicepzz", "/vicep0", and others. The presence of these misnamed partitions cause the server processes to crash on startup, since the out of range partition ids are used as an index. Add a check for the bad partition names in VCheckPartitions to avoid attaching them. Log a warning for such partitions to let the admins know why the partitions are not attached. Reviewed-on: https://gerrit.openafs.org/13038 Reviewed-by: Benjamin Kaduk Reviewed-by: Marcio Brito Barbosa Reviewed-by: Andrew Deason Reviewed-by: Mark Vitale Tested-by: Benjamin Kaduk (cherry picked from commit c0f2c26e9298d12209fbb5e523ea3173202316e5) Change-Id: Id7dcbd80402b7c8ec1f0e2e5fa2ea0123a2da898 Reviewed-on: https://gerrit.openafs.org/13120 Tested-by: BuildBot Reviewed-by: Michael Meffie Reviewed-by: Benjamin Kaduk --- diff --git a/src/vol/partition.c b/src/vol/partition.c index 272ada35d..4bd034468 100644 --- a/src/vol/partition.c +++ b/src/vol/partition.c @@ -289,6 +289,10 @@ VCheckPartition(char *part, char *devname, int logging) if (strncmp(part, VICE_PARTITION_PREFIX, VICE_PREFIX_SIZE)) { return 0; } + if (volutil_GetPartitionID(part) == -1) { + Log("Warning: %s is a bad partition name; ignored.\n", part); + return 0; + } if (afs_stat(part, &status) < 0) { Log("VInitVnodes: Couldn't find file system %s; ignored\n", part); return 0;