diff options
author | P J P <ppandit@redhat.com> | 2013-04-02 22:38:00 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk.kim@samsung.com> | 2013-04-03 04:27:52 -0400 |
commit | cfb185a1488810fbae9256c7d52f66c558c6ea04 (patch) | |
tree | 5d6f89c0d25fcbf4cfdf37edc1e59f7e43df8636 /fs/f2fs | |
parent | b2f2c390c5612df97f0403e1ef1e4e41c24b7d4f (diff) |
f2fs: add NULL pointer check
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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/data.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c index 47a2d7c87ea9..cf9ff5f76134 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, | |||
559 | int ret; | 559 | int ret; |
560 | long excess_nrtw = 0, desired_nrtw; | 560 | long excess_nrtw = 0, desired_nrtw; |
561 | 561 | ||
562 | /* deal with chardevs and other special file */ | ||
563 | if (!mapping->a_ops->writepage) | ||
564 | return 0; | ||
565 | |||
562 | if (wbc->nr_to_write < MAX_DESIRED_PAGES_WP) { | 566 | if (wbc->nr_to_write < MAX_DESIRED_PAGES_WP) { |
563 | desired_nrtw = MAX_DESIRED_PAGES_WP; | 567 | desired_nrtw = MAX_DESIRED_PAGES_WP; |
564 | excess_nrtw = desired_nrtw - wbc->nr_to_write; | 568 | excess_nrtw = desired_nrtw - wbc->nr_to_write; |