mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gu Zheng <guz.fnst@cn.fujitsu.com>
To: Chao Yu <chao2.yu@samsung.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>,
	Changman Lee <cm224.lee@samsung.com>,
	<linux-f2fs-devel@lists.sourceforge.net>,
	<linux-fsdevel@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [f2fs-dev][PATCH] f2fs: avoid to access NULL pointer in issue_flush_thread
Date: Mon, 7 Jul 2014 09:58:45 +0800	[thread overview]
Message-ID: <53B9FED5.80009@cn.fujitsu.com> (raw)
In-Reply-To: <006001cf9984$6b07f490$4117ddb0$@samsung.com>

Hi Yu,
Thanks for your catch.

Regards,
Gu
On 07/07/2014 09:39 AM, Chao Yu wrote:

> Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=75861
> 
> Denis 2014-05-10 11:28:59 UTC reported:
> "F2FS-fs (mmcblk0p28): mounting..
>  Unable to handle kernel NULL pointer dereference at virtual address 00000018
>  ...
>  [<c0a2f678>] (_raw_spin_lock+0x3c/0x70) from [<c03a0330>] (issue_flush_thread+0x50/0x17c)
>  [<c03a0330>] (issue_flush_thread+0x50/0x17c) from [<c01b4064>] (kthread+0x98/0xa4)
>  [<c01b4064>] (kthread+0x98/0xa4) from [<c0108060>] (kernel_thread_exit+0x0/0x8)"
> 
> This patch assign cmd_control_info in sm_info before issue_flush_thread is being
> created, so this make sure that issue flush thread will have no chance to access
> invalid info in fcc.
> 
> Signed-off-by: Chao Yu <chao2.yu@samsung.com>

Reviewed-by: Gu Zheng <guz.fnst@cn.fujitsu.com>

> ---
>  fs/f2fs/segment.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index bb5980d..a4f8375 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -272,14 +272,15 @@ int create_flush_cmd_control(struct f2fs_sb_info *sbi)
>  		return -ENOMEM;
>  	spin_lock_init(&fcc->issue_lock);
>  	init_waitqueue_head(&fcc->flush_wait_queue);
> +	sbi->sm_info->cmd_control_info = fcc;
>  	fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi,
>  				"f2fs_flush-%u:%u", MAJOR(dev), MINOR(dev));
>  	if (IS_ERR(fcc->f2fs_issue_flush)) {
>  		err = PTR_ERR(fcc->f2fs_issue_flush);
>  		kfree(fcc);
> +		sbi->sm_info->cmd_control_info = NULL;
>  		return err;
>  	}
> -	sbi->sm_info->cmd_control_info = fcc;
>  
>  	return err;
>  }



      reply	other threads:[~2014-07-07  2:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-07  1:39 Chao Yu
2014-07-07  1:58 ` Gu Zheng [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=53B9FED5.80009@cn.fujitsu.com \
    --to=guz.fnst@cn.fujitsu.com \
    --cc=chao2.yu@samsung.com \
    --cc=cm224.lee@samsung.com \
    --cc=jaegeuk@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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

Powered by JetHome