All of lore.kernel.org
 help / color / mirror / Atom feed
* [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed()
@ 2016-12-15 19:37 Scott Mayhew
  2016-12-17 18:43 ` Steve Dickson
  0 siblings, 1 reply; 2+ messages in thread
From: Scott Mayhew @ 2016-12-15 19:37 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

Passing a path like /export1 to unexportfs_parsed() matches not only
/export1, but /export11, /export100, /export1forthemoney, etc. which can
result in some nasty surprises when unexporting individual exports.

Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 utils/exportfs/exportfs.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
index b7a910e..a763272 100644
--- a/utils/exportfs/exportfs.c
+++ b/utils/exportfs/exportfs.c
@@ -345,6 +345,8 @@ unexportfs_parsed(char *hname, char *path, int verbose)
 		nlen--;
 
 	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
+		if (strlen(exp->m_export.e_path) != nlen)
+			continue;
 		if (path && strncmp(path, exp->m_export.e_path, nlen))
 			continue;
 		if (htype != exp->m_client->m_type)
-- 
2.7.4


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

* Re: [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed()
  2016-12-15 19:37 [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed() Scott Mayhew
@ 2016-12-17 18:43 ` Steve Dickson
  0 siblings, 0 replies; 2+ messages in thread
From: Steve Dickson @ 2016-12-17 18:43 UTC (permalink / raw)
  To: Scott Mayhew; +Cc: linux-nfs



On 12/15/2016 02:37 PM, Scott Mayhew wrote:
> Passing a path like /export1 to unexportfs_parsed() matches not only
> /export1, but /export11, /export100, /export1forthemoney, etc. which can
> result in some nasty surprises when unexporting individual exports.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Committed... 

steved.

> ---
>  utils/exportfs/exportfs.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/utils/exportfs/exportfs.c b/utils/exportfs/exportfs.c
> index b7a910e..a763272 100644
> --- a/utils/exportfs/exportfs.c
> +++ b/utils/exportfs/exportfs.c
> @@ -345,6 +345,8 @@ unexportfs_parsed(char *hname, char *path, int verbose)
>  		nlen--;
>  
>  	for (exp = exportlist[htype].p_head; exp; exp = exp->m_next) {
> +		if (strlen(exp->m_export.e_path) != nlen)
> +			continue;
>  		if (path && strncmp(path, exp->m_export.e_path, nlen))
>  			continue;
>  		if (htype != exp->m_client->m_type)
> -- 2.7.4
> 

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

end of thread, other threads:[~2016-12-17 18:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-15 19:37 [nfs-utils PATCH] exportfs: fix path comparison in unexportfs_parsed() Scott Mayhew
2016-12-17 18:43 ` 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.