[PATCH] Making shares unaccessible at root level mountable (aka solving bsc#8950 ...again)

Pavel Shilovsky piastryyy at gmail.com
Sat Jul 2 08:53:22 UTC 2016


Replying to samba-technical since the original email was rejected
(unsubscribed email address).

2016-07-02 10:02 GMT+03:00 Pavel Shilovsky <pshilovsky at samba.org>:
> 2016-06-10 18:16 GMT+03:00 Aurélien Aptel <aaptel at suse.com>:
> ...
>> I've moved some things around. All of the prefix path components are
>> now checked for accessibility in cifs_do_mount(). This is more
>> robust and it lets us set the CIFS_MOUNT_USE_PREFIX_PATH flag earlier.
>>
>> I've updated the cifs_root_iget() to use the prefix path when necessary
>> which should take care of the last case (hard mode).
>>
>> Please test my latest patch (attached).
>
> Hi Aurélien,
>
> Thank you for the patch, it looks good like a right thing to do.
>
> I put my comments below:
>
> @@ -649,6 +649,7 @@ cifs_get_root(struct smb_vol *vol, struct super_block *sb)
>   dentry = child;
>   } while (!IS_ERR(dentry));
>   kfree(full_path);
> +
>   return dentry;
>  }
>
> Please remove this unnecessary change - probably it will go to stable
> some day and may cause extra conflicts.
>
>
> @@ -1002,10 +1002,21 @@ struct inode *cifs_root_iget(struct super_block *sb)
>   struct inode *inode = NULL;
>   long rc;
>   struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
> + char *path = NULL;
> + int len;
> +
> + if ((cifs_sb->mnt_cifs_flags & CIFS_MOUNT_USE_PREFIX_PATH) &&
> cifs_sb->prepath) {
> + len = strlen(cifs_sb->prepath);
> + path = kzalloc(len + 2 /* leading sep + null */, GFP_KERNEL);
> + path[0] = '/';
> + memcpy(path+1, cifs_sb->prepath, len);
> + } else {
> + path = kstrdup("", GFP_KERNEL);
> + }
>
> The above code should check for possible memory allocation failure.
>
> --
> Best regards,
> Pavel Shilovsky



-- 
Best regards,
Pavel Shilovsky



More information about the samba-technical mailing list