Re: [PATCH] exportfs: make root unexportable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi SteveD,

This is a real problem introduced by my previous update. Sorry for it.

How about also adding this tag:
    Fixes: a9a7728d (exportfs: Deal with path's trailing "/" in unexportfs_parsed())

Thanks,
Yongcheng

On Mon, Mar 29, 2021 at 12:54:35PM +0200, Roberto Bergantinos Corpas wrote:
> If root of the filesystem is exported, it cannot be explicitly
> unexported, since unexportfs_parsed, in order to deal with trailing
> '/', will leave nlen at 0 for root exported case
> 
> Signed-off-by: Roberto Bergantinos Corpas <rbergant@xxxxxxxxxx>
> ---
>  utils/exportfs/exportfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index 9fcae0b3..9b6f4f5a 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -372,7 +372,7 @@ unexportfs_parsed(char *hname, char *path, int verbose)
>  	 * so need to deal with it.
>  	*/
>  	size_t nlen = strlen(path);
> -	while (path[nlen - 1] == '/')
> +	while ((path[nlen - 1] == '/') && (nlen > 1))
>  		nlen--;
>  
>  	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
> -- 
> 2.21.0
> 




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux