linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Vivek Trivedi <t.vivek@samsung.com>, linux-nfs@vger.kernel.org
Cc: a.sahrawat@samsung.com, pankaj.m@samsung.com
Subject: Re: [PATCH] mountd: fix mount issue due to comparison with uninitialized uuid
Date: Wed, 16 Sep 2015 15:08:39 -0400	[thread overview]
Message-ID: <55F9BE37.8070400@RedHat.com> (raw)
In-Reply-To: <1438949454-12216-1-git-send-email-t.vivek@samsung.com>



On 08/07/2015 08:10 AM, Vivek Trivedi wrote:
> 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>
Committed... 

steved.

> ---
>  utils/mountd/cache.c |    9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
> index 7d250f9..7847446 100644
> --- a/utils/mountd/cache.c
> +++ b/utils/mountd/cache.c
> @@ -638,18 +638,17 @@ static bool match_fsid(struct parsed_fsid *parsed, nfs_export *exp, char *path)
>  		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;
> 

      reply	other threads:[~2015-09-16 19:08 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 12:10 [PATCH] mountd: fix mount issue due to comparison with uninitialized uuid Vivek Trivedi
2015-09-16 19:08 ` Steve Dickson [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55F9BE37.8070400@RedHat.com \
    --to=steved@redhat.com \
    --cc=a.sahrawat@samsung.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=pankaj.m@samsung.com \
    --cc=t.vivek@samsung.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).