From: Jaegeuk Kim <jaegeuk.kim@samsung.com>
To: P J P <ppandit@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Petr Matousek <pmatouse@redhat.com>
Subject: Re: [PATCH] To add NULL pointer check
Date: Wed, 03 Apr 2013 12:03:13 +0900 [thread overview]
Message-ID: <1364958193.4353.4.camel@kjgkr> (raw)
In-Reply-To: <alpine.LFD.2.03.1304021808410.12716@erqung.pbz>
[-- Attachment #1: Type: text/plain, Size: 1719 bytes --]
Hi,
Thank you for your contribution.
As I consider the null pointer check, generic_writepages() originally
does so.
Therefore, I think f2fs_write_data_pages() is better to handle this.
Please review the modified patch.
Thanks,
---
From d3c811a51c7062fb1b66bec910ed346447c02032 Mon Sep 17 00:00:00 2001
From: P J P <ppandit@redhat.com>
Date: Wed, 3 Apr 2013 11:38:00 +0900
Subject: [PATCH] f2fs: add NULL pointer check
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net
Commit - fa9150a84c - replaces a call to generic_writepages() in
f2fs_write_data_pages() with write_cache_pages(), with a function
pointer
argument pointing to routine: __f2fs_writepage.
->
https://git.kernel.org/linus/fa9150a84ca333f68127097c4fa1eda4b3913a22
This patch adds a NULL pointer check in f2fs_write_data_pages() to
avoid
a possible NULL pointer dereference, in case if -
mapping->a_ops->writepage -
is NULL.
Signed-off-by: P J P <ppandit@redhat.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
---
fs/f2fs/data.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
index 47a2d7c..cf9ff5f 100644
--- a/fs/f2fs/data.c
+++ b/fs/f2fs/data.c
@@ -559,6 +559,10 @@ static int f2fs_write_data_pages(struct
address_space *mapping,
int ret;
long excess_nrtw = 0, desired_nrtw;
+ /* deal with chardevs and other special file */
+ if (!mapping->a_ops->writepage)
+ return 0;
+
if (wbc->nr_to_write < MAX_DESIRED_PAGES_WP) {
desired_nrtw = MAX_DESIRED_PAGES_WP;
excess_nrtw = desired_nrtw - wbc->nr_to_write;
--
1.8.1.3.566.gaa39828
--
Jaegeuk Kim
Samsung
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
next prev parent reply other threads:[~2013-04-03 3:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-02 12:57 [PATCH] To add NULL pointer check P J P
2013-04-03 3:03 ` Jaegeuk Kim [this message]
2013-04-03 4:25 ` Namjae Jeon
2013-04-03 6:39 ` P J P
2013-04-03 7:00 ` P J P
2013-04-03 7:54 ` Jaegeuk Kim
2013-04-03 9:13 ` P J P
2013-04-04 0:14 ` Jaegeuk Kim
2013-04-04 5:28 ` P J P
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=1364958193.4353.4.camel@kjgkr \
--to=jaegeuk.kim@samsung.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmatouse@redhat.com \
--cc=ppandit@redhat.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).