From: Chao Yu <chao2.yu@samsung.com>
To: 'Jaegeuk Kim' <jaegeuk@kernel.org>,
'Tommi Rantala' <tt.rantala@gmail.com>
Cc: 'Dave Jones' <davej@redhat.com>,
trinity@vger.kernel.org, 'LKML' <linux-kernel@vger.kernel.org>,
linux-f2fs-devel@lists.sourceforge.net
Subject: RE: [f2fs-dev] f2fs get_dnode_of_data oops
Date: Tue, 09 Sep 2014 16:10:00 +0800 [thread overview]
Message-ID: <003301cfcc05$95bfc6f0$c13f54d0$@samsung.com> (raw)
In-Reply-To: <20140909044157.GA24581@jaegeuk-mac02.hsd1.ca.comcast.net>
Hi Jaegeuk,
Looks good to me!
One nitpick, how about judging this condition before we lock ->i_mutex to
avoid unneeded lock contention and invoking of i_size_read()?
Thanks,
Yu
> -----Original Message-----
> From: Jaegeuk Kim [mailto:jaegeuk@kernel.org]
> Sent: Tuesday, September 09, 2014 12:42 PM
> To: Tommi Rantala
> Cc: Dave Jones; trinity@vger.kernel.org; LKML; linux-f2fs-devel@lists.sourceforge.net
> Subject: Re: [f2fs-dev] f2fs get_dnode_of_data oops
>
> Hi Tommi,
>
> This patch should resolve this bug.
> Thanks a lot. :)
>
> >From ee24677b9917583f50f16b6f59771439f91b890c Mon Sep 17 00:00:00 2001
> From: Jaegeuk Kim <jaegeuk@kernel.org>
> Date: Mon, 8 Sep 2014 10:59:43 -0700
> Subject: [PATCH] f2fs: fix negative value for lseek offset
>
> If application throws negative value of lseek with SEEK_DATA|SEEK_HOLE,
> previous f2fs went into BUG_ON in get_dnode_of_data, which was reported
> by Tommi Rantala.
>
> He could make a simple code to detect this having:
> lseek(fd, -17595150933902LL, SEEK_DATA);
>
> This patch should resolve that bug.
>
> Reported-by: Tommi Rentala <tt.rantala@gmail.com>
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
> fs/f2fs/file.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9f0ea3d..c9a1295 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -281,7 +281,7 @@ static loff_t f2fs_seek_block(struct file *file, loff_t offset, int whence)
> mutex_lock(&inode->i_mutex);
>
> isize = i_size_read(inode);
> - if (offset >= isize)
> + if (offset >= isize || offset < 0)
> goto fail;
>
> /* handle inline data case */
> --
> 1.8.5.2 (Apple Git-48)
>
>
> ------------------------------------------------------------------------------
> Want excitement?
> Manually upgrade your production database.
> When you want reliability, choose Perforce.
> Perforce version control. Predictably reliable.
> http://pubads.g.doubleclick.net/gampad/clk?id=157508191&iu=/4140/ostg.clktrk
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2014-09-09 8:10 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-07 19:14 f2fs get_dnode_of_data oops Tommi Rantala
2014-09-07 19:20 ` Tommi Rantala
2014-09-08 4:20 ` Jaegeuk Kim
2014-09-08 15:39 ` Tommi Rantala
2014-09-09 4:41 ` Jaegeuk Kim
2014-09-09 8:10 ` Chao Yu [this message]
2014-09-10 7:23 ` [f2fs-dev] " Jaegeuk Kim
2014-09-09 18:24 ` Tommi Rantala
2014-09-10 7:26 ` Jaegeuk Kim
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='003301cfcc05$95bfc6f0$c13f54d0$@samsung.com' \
--to=chao2.yu@samsung.com \
--cc=davej@redhat.com \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=trinity@vger.kernel.org \
--cc=tt.rantala@gmail.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).