diff --git src/wp-includes/functions.php src/wp-includes/functions.php
index 53a2204..ed4a6fa 100644
--- src/wp-includes/functions.php
+++ src/wp-includes/functions.php
@@ -1680,6 +1680,10 @@ function wp_mkdir_p( $target ) {
 	// We need to find the permissions of the parent folder that exists and inherit that.
 	$target_parent = dirname( $target );
 	while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
+		// Infinite loop protection (see https://core.trac.wordpress.org/ticket/43417)
+		if ( dirname( $target_parent ) === $target_parent ) {
+			break;
+		}
 		$target_parent = dirname( $target_parent );
 	}
 
