Skip to contentSkip to conversation

mount: segmentation faults on UDP mounts

PATCH In review Steve Dickson 2 participants 2 messages Feb 17, 2009 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount: segmentation faults on UDP mounts

This came in over the weekend... when a server only supports UDP mounts, mount seg faults... this patch fixes the problem...

steved.

commit 52ec1b5fceece8f63b97afc6d6b78bfabff12669

Author: Steve Dickson <[email protected]>
Date:   Tue Feb 17 15:33:58 2009 -0500

The mount sockaddr len (mnt_salen) is not be set in nfs_extract_server_addresses() which causes the mount.nfs command to segmentation fault when a NFS server only supports UDP mounts.

utils/mount/stropts.c +3 -2
index 770b5b5..c369136 100644
@@ -331,9 +331,10 @@ static int nfs_extract_server_addresses(struct mount_options *options,
 		return 0;
 
 	option = po_get(options, "mountaddr");
-	if (option == NULL)
+	if (option == NULL) {
 		memcpy(mnt_saddr, nfs_saddr, *nfs_salen);
-	else if (!nfs_string_to_sockaddr(option, strlen(option),
+		*mnt_salen = *nfs_salen;
+	} else if (!nfs_string_to_sockaddr(option, strlen(option),
 						mnt_saddr, mnt_salen))
 		return 0;
 
Acked-by
#2 lore raw
In reply to a message not in the archive
Quoted 23 lines · Steve Dickson

This came in over the weekend... when a server only supports UDP mounts, mount seg faults... this patch fixes the problem...

steved.

commit 52ec1b5fceece8f63b97afc6d6b78bfabff12669

Author: Steve Dickson <[email protected]>
Date:   Tue Feb 17 15:33:58 2009 -0500

The mount sockaddr len (mnt_salen) is not be set in nfs_extract_server_addresses() which causes the mount.nfs command to segmentation fault when a NFS server only supports UDP mounts.

utils/mount/stropts.c +0 -0
index 770b5b5..c369136 100644
@@ -331,9 +331,10 @@ static int nfs_extract_server_addresses(struct  
 mount_options *options,
 		return 0;

utils/mount/stropts.c static int nfs_extract_server_addresses(struct · line 340

Quoted 10 lines
utils/mount/stropts.c +3 -2
 
 	option = po_get(options, "mountaddr");
-	if (option == NULL)
+	if (option == NULL) {
 		memcpy(mnt_saddr, nfs_saddr, *nfs_salen);
-	else if (!nfs_string_to_sockaddr(option, strlen(option),
+		*mnt_salen = *nfs_salen;
+	} else if (!nfs_string_to_sockaddr(option, strlen(option),
 						mnt_saddr, mnt_salen))
 		return 0;

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com