mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
To: Namjae Jeon <linkinjeon@gmail.com>
Cc: akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Namjae Jeon <namjae.jeon@samsung.com>,
	Ravishankar N <ravi.n1@samsung.com>,
	Amit Sahrawat <a.sahrawat@samsung.com>
Subject: Re: [PATCH v5 5/8] fat: restructure export_operations
Date: Wed, 05 Dec 2012 21:11:22 +0900	[thread overview]
Message-ID: <87pq2owvf9.fsf@devron.myhome.or.jp> (raw)
In-Reply-To: <CAKYAXd_T2yGRXd3bk5HXXuVhx_ikO1xzinOy0d8TobokyiCRsA@mail.gmail.com> (Namjae Jeon's message of "Wed, 5 Dec 2012 20:45:40 +0900")

Namjae Jeon <linkinjeon@gmail.com> writes:

>> I can understand what is doing. I'm asking why there is difference.
>>
>> 1) generic_fh_to_dentry() allows (*_PARENT && fh_len == 2).
>> 2) fat_fh_to_dentry_nostale() doesn't allows (*_PARENT && fh_len == 3).
>>
>> Why does logic has difference?
>
> When we consider the generic routine of encode_fh() and the structure ‘fid’
>
> struct fid {
>       struct {
>             u32 ino;
>             u32 gen;
>             u32 parent_ino;
>             u32 parent_gen;
>       } i32;
> };
>
> fh_len= 2(without parent)
> fh_len=4(with parent)
>
> Condition checking in export_encode_fh()
> {
>
>    if (parent && (len < 4)) {
>                 *max_len = 4;
>                 return FILEID_INVALID;
>         } else if (len < 2) {
>                 *max_len = 2;
>                 return FILEID_INVALID;
>         }
>         ...
>                 len = 2;
>         ...
>                 if (parent) {
> ..
>                                 len = 4;
>                                 type = FILEID_INO32_GEN_PARENT;
>                 }
> …
> }
>
> The logic does take care of altering the length for the ‘2’ cases
> with/without parent.
> So, while encoding -> the care has been taken for length checking but
> while decoding(generic_fh_to_dentry) the length check is not put in
> place.
> I think it should be done in the generic routine also.
>
> It should be:
> if ((fh_len != 2 && fh_len != 4) ||
>                 (fh_type != FILEID_INO32_GEN && fh_type !=
> FILEID_INO32_GEN_PARENT))
>     return NULL;
>
> Please share your opinion.

I know encode_fh(). But NFS is network protocol, and network can input
any data, and I guess the userland interface (open_by_handle()?) can be
any too.

And generic_fh_to_dentry()'s input verify choose to check the minimum
length only. But your logic choose the exact length.

I think the both is sane and correct. But I wonder why did you changed it.
-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

  reply	other threads:[~2012-12-05 12:11 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 13:24 Namjae Jeon
2012-12-03  9:51 ` OGAWA Hirofumi
2012-12-04  6:23   ` Namjae Jeon
2012-12-04  9:28     ` OGAWA Hirofumi
2012-12-05  5:58       ` Namjae Jeon
2012-12-05  8:56         ` OGAWA Hirofumi
2012-12-05 11:45           ` Namjae Jeon
2012-12-05 12:11             ` OGAWA Hirofumi [this message]
2012-12-06  7:37               ` Namjae Jeon
2012-12-06  9:24                 ` OGAWA Hirofumi
2012-12-06  9:43                   ` Namjae Jeon

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=87pq2owvf9.fsf@devron.myhome.or.jp \
    --to=hirofumi@mail.parknet.co.jp \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=linkinjeon@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=namjae.jeon@samsung.com \
    --cc=ravi.n1@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

all inboxes | Powered by JetHome®