autofs-5.0.8 - check for bind onto self in mount_bind.c

From: Ian Kent <raven@themaw.net>

Check for an obviously impossible request to bind or symlink to the
same patch for source and target.
---
 CHANGELOG            |    1 +
 modules/mount_bind.c |    6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/CHANGELOG b/CHANGELOG
index de72fa1..3bd9c04 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -23,6 +23,7 @@
 - fix symlink fail message in mount_bind.c.
 - fix cache readlock not taken on lookup.
 - pass map_source as function paramter where possible.
+- check for bind onto self in mount_bind.c.
 
 17/10/2013 autofs-5.0.8
 =======================
diff --git a/modules/mount_bind.c b/modules/mount_bind.c
index 8cb1605..f14adb7 100644
--- a/modules/mount_bind.c
+++ b/modules/mount_bind.c
@@ -135,6 +135,12 @@ int mount_mount(struct autofs_point *ap, const char *root, const char *name, int
 	if (options == NULL || *options == '\0')
 		options = "defaults";
 
+	if (!strcmp(what, fullpath)) {
+		debug(ap->logopt, MODPREFIX
+		     "cannot mount or symlink %s to itself", fullpath);
+		return 1;
+	}
+
 	if (!symlnk && bind_works) {
 		int status, existed = 1;