File 0001-mountd-fix-mount-issue-due-to-comparison-with-uninit.patch of Package nfs-utils.33226
From 78240c41be17bd20d5fb5b70b6f470d8e779adee Mon Sep 17 00:00:00 2001
From: Vivek Trivedi <t.vivek@samsung.com>
Date: Wed, 16 Sep 2015 11:14:03 -0400
Subject: [PATCH] mountd: fix mount issue due to comparison with uninitialized
uuid
Fix mount issue due to comparison of uninitialized variable
u(uuid) with parsed->fhuuid when uuid_by_path return 0.
/tmp/usb
192.168.1.0/16(ro,no_root_squash,no_subtree_check,fsid=0)
/tmp/usb/sda1 192.168.1.0/16(ro,no_root_squash,no_subtree_check)
/tmp/usb/sdb1 192.168.1.0/16(ro,no_root_squash,no_subtree_check)
mount -t nfs -o nolock,nfsvers=3 192.168.1.2:/tmp/usb/sda1 /tmp/sda1
mount -t nfs -o nolock,nfsvers=3 192.168.1.2:/tmp/usb/sdb1 /tmp/sdb1
results in below mountd error:
mountd: /tmp/usb and /tmp/usb/sdb1 have same filehandle for
192.168.1.0/16, using first
when uuid_by_path returned 0, by chance, garbage value of u was same as
parsed->fhuuid(of sdb1), and comparison of these resulted in above
error.
Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
Reviewed-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/mountd/cache.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -547,18 +547,17 @@ static bool match_fsid(struct parsed_fsi
if (!is_mountpoint(path))
return false;
check_uuid:
- if (exp->m_export.e_uuid)
+ if (exp->m_export.e_uuid) {
get_uuid(exp->m_export.e_uuid, parsed->uuidlen, u);
+ if (memcmp(u, parsed->fhuuid, parsed->uuidlen) == 0)
+ return true;
+ }
else
for (type = 0;
uuid_by_path(path, type, parsed->uuidlen, u);
type++)
if (memcmp(u, parsed->fhuuid, parsed->uuidlen) == 0)
return true;
-
- if (memcmp(u, parsed->fhuuid, parsed->uuidlen) != 0)
- return false;
- return true;
}
/* Well, unreachable, actually: */
return false;