All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] exportfs: make root unexportable
@ 2021-03-29 10:54 Roberto Bergantinos Corpas
  2021-03-30  8:43 ` Yongcheng Yang
  2021-04-07 18:30 ` Steve Dickson
  0 siblings, 2 replies; 3+ messages in thread
From: Roberto Bergantinos Corpas @ 2021-03-29 10:54 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

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@redhat.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] exportfs: make root unexportable
  2021-03-29 10:54 [PATCH] exportfs: make root unexportable Roberto Bergantinos Corpas
@ 2021-03-30  8:43 ` Yongcheng Yang
  2021-04-07 18:30 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Yongcheng Yang @ 2021-03-30  8:43 UTC (permalink / raw)
  To: steved; +Cc: Roberto Bergantinos Corpas, linux-nfs

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@redhat.com>
> ---
>  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
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] exportfs: make root unexportable
  2021-03-29 10:54 [PATCH] exportfs: make root unexportable Roberto Bergantinos Corpas
  2021-03-30  8:43 ` Yongcheng Yang
@ 2021-04-07 18:30 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2021-04-07 18:30 UTC (permalink / raw)
  To: Roberto Bergantinos Corpas; +Cc: linux-nfs

Hello,

On 3/29/21 6:54 AM, 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@redhat.com>
> ---
>  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--;
I decided to use Ondrej's version sine the nlen is tested
first before the index into path was made.

steved.
>  
>  	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-04-07 18:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-29 10:54 [PATCH] exportfs: make root unexportable Roberto Bergantinos Corpas
2021-03-30  8:43 ` Yongcheng Yang
2021-04-07 18:30 ` Steve Dickson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.