linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* exportfs crash with long path
@ 2012-10-08 15:07 Ivan Romanov
  2012-10-10 12:28 ` J. Bruce Fields
  2012-10-15 17:13 ` Steve Dickson
  0 siblings, 2 replies; 3+ messages in thread
From: Ivan Romanov @ 2012-10-08 15:07 UTC (permalink / raw)
  To: steved; +Cc: linux-nfs

[-- Attachment #1: Type: text/plain, Size: 795 bytes --]

Hello. I opened a bug with nfs-utils on Redhat Bugzilla. And got an
advice to email upstream. So I just repeat my bug text with a patch.

How reproducible:
always

Steps to Reproduce:
# mkdir -p /home/kudinae/Общедоступные
# echo '/home/kudinae/Общедоступные oek-1(rw,sync,no_wdelay,no_root_squash,no_subtree_check)' > /etc/exports
# exportfs -a
Segmentation fault

I've obtained the sources. So a crush happens on export.c:293. variable
pos has negative value. I think problem into strtoint and export_hash
functions. strtoint has unsigned type and always returns positive value
but export_hash impicity cast it to signed int. So it is possible to
get negative value. I wrote patch to fix this.

Original Red Hat bug
https://bugzilla.redhat.com/show_bug.cgi?id=863054

[-- Attachment #2: nfs-utils-hash.patch --]
[-- Type: text/x-patch, Size: 333 bytes --]

diff --git a/support/export/export.c b/support/export/export.c
index 4fda30a..0257903 100644
--- a/support/export/export.c
+++ b/support/export/export.c
@@ -357,7 +357,7 @@ strtoint(char *str)
 static int 
 export_hash(char *str)
 {
-	int num = strtoint(str);
+	unsigned int num = strtoint(str);
 
 	return num % HASH_TABLE_SIZE;
 }

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

* Re: exportfs crash with long path
  2012-10-08 15:07 exportfs crash with long path Ivan Romanov
@ 2012-10-10 12:28 ` J. Bruce Fields
  2012-10-15 17:13 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: J. Bruce Fields @ 2012-10-10 12:28 UTC (permalink / raw)
  To: Ivan Romanov; +Cc: steved, linux-nfs

On Mon, Oct 08, 2012 at 09:07:08PM +0600, Ivan Romanov wrote:
> Hello. I opened a bug with nfs-utils on Redhat Bugzilla. And got an
> advice to email upstream. So I just repeat my bug text with a patch.
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> # mkdir -p /home/kudinae/Общедоступные
> # echo '/home/kudinae/Общедоступные oek-1(rw,sync,no_wdelay,no_root_squash,no_subtree_check)' > /etc/exports
> # exportfs -a
> Segmentation fault
> 
> I've obtained the sources. So a crush happens on export.c:293. variable
> pos has negative value. I think problem into strtoint and export_hash
> functions. strtoint has unsigned type and always returns positive value
> but export_hash impicity cast it to signed int. So it is possible to
> get negative value. I wrote patch to fix this.

The fix looks right to me, thanks.--b.

> 
> Original Red Hat bug
> https://bugzilla.redhat.com/show_bug.cgi?id=863054

> diff --git a/support/export/export.c b/support/export/export.c
> index 4fda30a..0257903 100644
> --- a/support/export/export.c
> +++ b/support/export/export.c
> @@ -357,7 +357,7 @@ strtoint(char *str)
>  static int 
>  export_hash(char *str)
>  {
> -	int num = strtoint(str);
> +	unsigned int num = strtoint(str);
>  
>  	return num % HASH_TABLE_SIZE;
>  }


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

* Re: exportfs crash with long path
  2012-10-08 15:07 exportfs crash with long path Ivan Romanov
  2012-10-10 12:28 ` J. Bruce Fields
@ 2012-10-15 17:13 ` Steve Dickson
  1 sibling, 0 replies; 3+ messages in thread
From: Steve Dickson @ 2012-10-15 17:13 UTC (permalink / raw)
  To: Ivan Romanov; +Cc: linux-nfs



On 08/10/12 11:07, Ivan Romanov wrote:
> Hello. I opened a bug with nfs-utils on Redhat Bugzilla. And got an
> advice to email upstream. So I just repeat my bug text with a patch.
> 
> How reproducible:
> always
> 
> Steps to Reproduce:
> # mkdir -p /home/kudinae/Общедоступные
> # echo '/home/kudinae/Общедоступные oek-1(rw,sync,no_wdelay,no_root_squash,no_subtree_check)' > /etc/exports
> # exportfs -a
> Segmentation fault
> 
> I've obtained the sources. So a crush happens on export.c:293. variable
> pos has negative value. I think problem into strtoint and export_hash
> functions. strtoint has unsigned type and always returns positive value
> but export_hash impicity cast it to signed int. So it is possible to
> get negative value. I wrote patch to fix this.
> 
> Original Red Hat bug
> https://bugzilla.redhat.com/show_bug.cgi?id=863054
> 
Committed...

steved.

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

end of thread, other threads:[~2012-10-15 17:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-08 15:07 exportfs crash with long path Ivan Romanov
2012-10-10 12:28 ` J. Bruce Fields
2012-10-15 17:13 ` Steve Dickson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).