mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 1/1] f2fs: correctly check empty xattr key
@ 2015-03-20  4:19 Taesoo Kim
  2015-03-20 20:52 ` Jaegeuk Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Taesoo Kim @ 2015-03-20  4:19 UTC (permalink / raw)
  To: jaegeuk, cm224.lee, linux-f2fs-devel, linux-kernel
  Cc: taesoo, changwoo, sanidhya, blee, csong84, Taesoo Kim

When xattr name (key) is empty (""), correctly return -EINVAL
error. xattr_advise_set/get() seem to make the same mistake.

Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
---
 fs/f2fs/xattr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
index 5072bf9..6b1fbc4 100644
--- a/fs/f2fs/xattr.c
+++ b/fs/f2fs/xattr.c
@@ -132,7 +132,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
 {
 	struct inode *inode = dentry->d_inode;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;
 
 	*((char *)buffer) = F2FS_I(inode)->i_advise;
@@ -144,7 +144,7 @@ static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
 {
 	struct inode *inode = dentry->d_inode;
 
-	if (strcmp(name, "") != 0)
+	if (strcmp(name, "") == 0)
 		return -EINVAL;
 	if (!inode_owner_or_capable(inode))
 		return -EPERM;
-- 
2.3.3


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

* Re: [PATCH 1/1] f2fs: correctly check empty xattr key
  2015-03-20  4:19 [PATCH 1/1] f2fs: correctly check empty xattr key Taesoo Kim
@ 2015-03-20 20:52 ` Jaegeuk Kim
  2015-03-23  1:13   ` Taesoo Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Jaegeuk Kim @ 2015-03-20 20:52 UTC (permalink / raw)
  To: Taesoo Kim
  Cc: cm224.lee, linux-f2fs-devel, linux-kernel, taesoo, changwoo,
	sanidhya, blee, csong84

Hi Taesoo,

On Fri, Mar 20, 2015 at 12:19:07AM -0400, Taesoo Kim wrote:
> When xattr name (key) is empty (""), correctly return -EINVAL
> error. xattr_advise_set/get() seem to make the same mistake.

The intention here is to disallow any xattr name, since this is used to get or
set the i_advise value by users.

Thanks,

> 
> Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
> ---
>  fs/f2fs/xattr.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> index 5072bf9..6b1fbc4 100644
> --- a/fs/f2fs/xattr.c
> +++ b/fs/f2fs/xattr.c
> @@ -132,7 +132,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
>  {
>  	struct inode *inode = dentry->d_inode;
>  
> -	if (strcmp(name, "") != 0)
> +	if (strcmp(name, "") == 0)
>  		return -EINVAL;
>  
>  	*((char *)buffer) = F2FS_I(inode)->i_advise;
> @@ -144,7 +144,7 @@ static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
>  {
>  	struct inode *inode = dentry->d_inode;
>  
> -	if (strcmp(name, "") != 0)
> +	if (strcmp(name, "") == 0)
>  		return -EINVAL;
>  	if (!inode_owner_or_capable(inode))
>  		return -EPERM;
> -- 
> 2.3.3

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

* Re: [PATCH 1/1] f2fs: correctly check empty xattr key
  2015-03-20 20:52 ` Jaegeuk Kim
@ 2015-03-23  1:13   ` Taesoo Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Taesoo Kim @ 2015-03-23  1:13 UTC (permalink / raw)
  To: Jaegeuk Kim
  Cc: Taesoo Kim, cm224.lee, linux-f2fs-devel, linux-kernel, changwoo,
	sanidhya, blee, csong84

Hi Jaegeuk,

Thank you for letting us know. We have another question:

@f2fs_sync_file()

  if (unlikely(f2fs_readonly(inode->i_sb)))
     return 0;

Isn't it better to report '-EROFS' as ext3/4? I suspect that f2fs
returns 0 as fsync() man page doesn't specify such error condition. We
are wondering if it is the real reason for f2fs's design decision.

Thank you,
Taesoo

On 03/20/15 at 01:52pm, Jaegeuk Kim wrote:
> Hi Taesoo,
> 
> On Fri, Mar 20, 2015 at 12:19:07AM -0400, Taesoo Kim wrote:
> > When xattr name (key) is empty (""), correctly return -EINVAL
> > error. xattr_advise_set/get() seem to make the same mistake.
> 
> The intention here is to disallow any xattr name, since this is used to get or
> set the i_advise value by users.
> 
> Thanks,
> 
> > 
> > Signed-off-by: Taesoo Kim <tsgatesv@gmail.com>
> > ---
> >  fs/f2fs/xattr.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/f2fs/xattr.c b/fs/f2fs/xattr.c
> > index 5072bf9..6b1fbc4 100644
> > --- a/fs/f2fs/xattr.c
> > +++ b/fs/f2fs/xattr.c
> > @@ -132,7 +132,7 @@ static int f2fs_xattr_advise_get(struct dentry *dentry, const char *name,
> >  {
> >  	struct inode *inode = dentry->d_inode;
> >  
> > -	if (strcmp(name, "") != 0)
> > +	if (strcmp(name, "") == 0)
> >  		return -EINVAL;
> >  
> >  	*((char *)buffer) = F2FS_I(inode)->i_advise;
> > @@ -144,7 +144,7 @@ static int f2fs_xattr_advise_set(struct dentry *dentry, const char *name,
> >  {
> >  	struct inode *inode = dentry->d_inode;
> >  
> > -	if (strcmp(name, "") != 0)
> > +	if (strcmp(name, "") == 0)
> >  		return -EINVAL;
> >  	if (!inode_owner_or_capable(inode))
> >  		return -EPERM;
> > -- 
> > 2.3.3

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

end of thread, other threads:[~2015-03-23  1:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20  4:19 [PATCH 1/1] f2fs: correctly check empty xattr key Taesoo Kim
2015-03-20 20:52 ` Jaegeuk Kim
2015-03-23  1:13   ` Taesoo Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome