All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05  4:16 ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05  4:16 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong, Colin Ian King

From: Daeho Jeong <daehojeong@google.com>

Fixed null page reference when find_lock_page() fails in
redirty_blocks().

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
---
v2: changed error value and break the loop when error occurs
---
 fs/f2fs/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9e5275716be8..d27173c24391 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
 
 	for (i = 0; i < page_len; i++, redirty_idx++) {
 		page = find_lock_page(mapping, redirty_idx);
-		if (!page)
-			ret = -ENOENT;
+		if (!page) {
+			ret = -ENOMEM;
+			break;
+		}
 		set_page_dirty(page);
 		f2fs_put_page(page, 1);
 		f2fs_put_page(page, 0);
-- 
2.29.2.729.g45daf8777d-goog


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

* [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05  4:16 ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05  4:16 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Colin Ian King, Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

Fixed null page reference when find_lock_page() fails in
redirty_blocks().

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
---
v2: changed error value and break the loop when error occurs
---
 fs/f2fs/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9e5275716be8..d27173c24391 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
 
 	for (i = 0; i < page_len; i++, redirty_idx++) {
 		page = find_lock_page(mapping, redirty_idx);
-		if (!page)
-			ret = -ENOENT;
+		if (!page) {
+			ret = -ENOMEM;
+			break;
+		}
 		set_page_dirty(page);
 		f2fs_put_page(page, 1);
 		f2fs_put_page(page, 0);
-- 
2.29.2.729.g45daf8777d-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-05  4:16 ` [f2fs-dev] " Daeho Jeong
@ 2021-01-05  6:05   ` Chao Yu
  -1 siblings, 0 replies; 17+ messages in thread
From: Chao Yu @ 2021-01-05  6:05 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
  Cc: Colin Ian King, Daeho Jeong

On 2021/1/5 12:16, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05  6:05   ` Chao Yu
  0 siblings, 0 replies; 17+ messages in thread
From: Chao Yu @ 2021-01-05  6:05 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team
  Cc: Colin Ian King, Daeho Jeong

On 2021/1/5 12:16, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")

Reviewed-by: Chao Yu <yuchao0@huawei.com>

Thanks,


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-05  4:16 ` [f2fs-dev] " Daeho Jeong
@ 2021-01-05  9:34   ` Colin Ian King
  -1 siblings, 0 replies; 17+ messages in thread
From: Colin Ian King @ 2021-01-05  9:34 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

On 05/01/2021 04:16, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
> ---
> v2: changed error value and break the loop when error occurs
> ---
>  fs/f2fs/file.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9e5275716be8..d27173c24391 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
>  
>  	for (i = 0; i < page_len; i++, redirty_idx++) {
>  		page = find_lock_page(mapping, redirty_idx);
> -		if (!page)
> -			ret = -ENOENT;
> +		if (!page) {
> +			ret = -ENOMEM;
> +			break;
> +		}
>  		set_page_dirty(page);
>  		f2fs_put_page(page, 1);
>  		f2fs_put_page(page, 0);
> 
Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05  9:34   ` Colin Ian King
  0 siblings, 0 replies; 17+ messages in thread
From: Colin Ian King @ 2021-01-05  9:34 UTC (permalink / raw)
  To: Daeho Jeong, linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Daeho Jeong

On 05/01/2021 04:16, Daeho Jeong wrote:
> From: Daeho Jeong <daehojeong@google.com>
> 
> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().
> 
> Signed-off-by: Daeho Jeong <daehojeong@google.com>
> Reported-by: Colin Ian King <colin.king@canonical.com>
> Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
> ---
> v2: changed error value and break the loop when error occurs
> ---
>  fs/f2fs/file.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9e5275716be8..d27173c24391 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
>  
>  	for (i = 0; i < page_len; i++, redirty_idx++) {
>  		page = find_lock_page(mapping, redirty_idx);
> -		if (!page)
> -			ret = -ENOENT;
> +		if (!page) {
> +			ret = -ENOMEM;
> +			break;
> +		}
>  		set_page_dirty(page);
>  		f2fs_put_page(page, 1);
>  		f2fs_put_page(page, 0);
> 
Thanks, looks good to me.

Reviewed-by: Colin Ian King <colin.king@canonical.com>


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-05  4:16 ` [f2fs-dev] " Daeho Jeong
                   ` (2 preceding siblings ...)
  (?)
@ 2021-01-05 12:04 ` Markus Elfring
  2021-01-05 23:44     ` Daeho Jeong
  2021-01-06  1:03     ` Chao Yu
  -1 siblings, 2 replies; 17+ messages in thread
From: Markus Elfring @ 2021-01-05 12:04 UTC (permalink / raw)
  To: Daeho Jeong, linux-f2fs-devel, kernel-janitors
  Cc: Colin Ian King, kernel-team, linux-kernel

> Fixed null page reference when find_lock_page() fails in
> redirty_blocks().

I suggest to choose an other imperative wording for this change description.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89


> v2: changed error value and break the loop when error occurs

I propose to use a return statement instead of a break in the second if branch
for this function implementation.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481

Regards,
Markus


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-05 12:04 ` Markus Elfring
  2021-01-05 23:44     ` Daeho Jeong
@ 2021-01-05 23:44     ` Daeho Jeong
  1 sibling, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05 23:44 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Daeho Jeong, linux-f2fs-devel, kernel-janitors, Colin Ian King,
	kernel-team, linux-kernel

Got it~

Thanks,

2021년 1월 5일 (화) 오후 9:06, Markus Elfring <Markus.Elfring@web.de>님이 작성:
>
> > Fixed null page reference when find_lock_page() fails in
> > redirty_blocks().
>
> I suggest to choose an other imperative wording for this change description.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
>
>
> > v2: changed error value and break the loop when error occurs
>
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
>
> Regards,
> Markus
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05 23:44     ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05 23:44 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Daeho Jeong, kernel-janitors, linux-kernel, linux-f2fs-devel,
	Colin Ian King, kernel-team

Got it~

Thanks,

2021년 1월 5일 (화) 오후 9:06, Markus Elfring <Markus.Elfring@web.de>님이 작성:
>
> > Fixed null page reference when find_lock_page() fails in
> > redirty_blocks().
>
> I suggest to choose an other imperative wording for this change description.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
>
>
> > v2: changed error value and break the loop when error occurs
>
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
>
> Regards,
> Markus
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05 23:44     ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05 23:44 UTC (permalink / raw)
  To: Markus Elfring
  Cc: Daeho Jeong, kernel-janitors, linux-kernel, linux-f2fs-devel,
	Colin Ian King, kernel-team

Got it~

Thanks,

2021년 1월 5일 (화) 오후 9:06, Markus Elfring <Markus.Elfring@web.de>님이 작성:
>
> > Fixed null page reference when find_lock_page() fails in
> > redirty_blocks().
>
> I suggest to choose an other imperative wording for this change description.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
>
>
> > v2: changed error value and break the loop when error occurs
>
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
>
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
>
> Regards,
> Markus
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-05 12:04 ` Markus Elfring
  2021-01-05 23:44     ` Daeho Jeong
@ 2021-01-06  1:03     ` Chao Yu
  1 sibling, 0 replies; 17+ messages in thread
From: Chao Yu @ 2021-01-06  1:03 UTC (permalink / raw)
  To: Daeho Jeong
  Cc: Markus Elfring, linux-f2fs-devel, kernel-janitors,
	Colin Ian King, kernel-team, linux-kernel

Daeho,

FYI

https://www.spinics.net/lists/kernel/msg3595944.html

On 2021/1/5 20:04, Markus Elfring wrote:
>> Fixed null page reference when find_lock_page() fails in
>> redirty_blocks().
> 
> I suggest to choose an other imperative wording for this change description.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> 
> 
>> v2: changed error value and break the loop when error occurs
> 
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> 
> Regards,
> Markus
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-06  1:03     ` Chao Yu
  0 siblings, 0 replies; 17+ messages in thread
From: Chao Yu @ 2021-01-06  1:03 UTC (permalink / raw)
  To: Daeho Jeong
  Cc: kernel-janitors, linux-kernel, linux-f2fs-devel, Markus Elfring,
	Colin Ian King, kernel-team

Daeho,

FYI

https://www.spinics.net/lists/kernel/msg3595944.html

On 2021/1/5 20:04, Markus Elfring wrote:
>> Fixed null page reference when find_lock_page() fails in
>> redirty_blocks().
> 
> I suggest to choose an other imperative wording for this change description.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id6bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> 
> 
>> v2: changed error value and break the loop when error occurs
> 
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id6bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> 
> Regards,
> Markus
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-06  1:03     ` Chao Yu
  0 siblings, 0 replies; 17+ messages in thread
From: Chao Yu @ 2021-01-06  1:03 UTC (permalink / raw)
  To: Daeho Jeong
  Cc: kernel-janitors, linux-kernel, linux-f2fs-devel, Markus Elfring,
	Colin Ian King, kernel-team

Daeho,

FYI

https://www.spinics.net/lists/kernel/msg3595944.html

On 2021/1/5 20:04, Markus Elfring wrote:
>> Fixed null page reference when find_lock_page() fails in
>> redirty_blocks().
> 
> I suggest to choose an other imperative wording for this change description.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> 
> 
>> v2: changed error value and break the loop when error occurs
> 
> I propose to use a return statement instead of a break in the second if branch
> for this function implementation.
> 
> See also:
> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> 
> Regards,
> Markus
> 
> 
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> .
> 


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
  2021-01-06  1:03     ` Chao Yu
  (?)
@ 2021-01-06  3:35       ` Daeho Jeong
  -1 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-06  3:35 UTC (permalink / raw)
  To: Chao Yu
  Cc: Daeho Jeong, kernel-janitors, linux-kernel, linux-f2fs-devel,
	Markus Elfring, Colin Ian King, kernel-team

Thanks for the notice~

2021년 1월 6일 (수) 오전 10:04, Chao Yu <yuchao0@huawei.com>님이 작성:
>
> Daeho,
>
> FYI
>
> https://www.spinics.net/lists/kernel/msg3595944.html
>
> On 2021/1/5 20:04, Markus Elfring wrote:
> >> Fixed null page reference when find_lock_page() fails in
> >> redirty_blocks().
> >
> > I suggest to choose an other imperative wording for this change description.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> >
> >
> >> v2: changed error value and break the loop when error occurs
> >
> > I propose to use a return statement instead of a break in the second if branch
> > for this function implementation.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> >
> > Regards,
> > Markus
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > .
> >
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-06  3:35       ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-06  3:35 UTC (permalink / raw)
  To: Chao Yu
  Cc: Daeho Jeong, kernel-janitors, linux-kernel, linux-f2fs-devel,
	Markus Elfring, Colin Ian King, kernel-team

Thanks for the notice~

2021년 1월 6일 (수) 오전 10:04, Chao Yu <yuchao0@huawei.com>님이 작성:
>
> Daeho,
>
> FYI
>
> https://www.spinics.net/lists/kernel/msg3595944.html
>
> On 2021/1/5 20:04, Markus Elfring wrote:
> >> Fixed null page reference when find_lock_page() fails in
> >> redirty_blocks().
> >
> > I suggest to choose an other imperative wording for this change description.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> >
> >
> >> v2: changed error value and break the loop when error occurs
> >
> > I propose to use a return statement instead of a break in the second if branch
> > for this function implementation.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> >
> > Regards,
> > Markus
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > .
> >
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* Re: [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-06  3:35       ` Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-06  3:35 UTC (permalink / raw)
  To: Chao Yu
  Cc: Daeho Jeong, kernel-janitors, linux-kernel, linux-f2fs-devel,
	Markus Elfring, Colin Ian King, kernel-team

Thanks for the notice~

2021년 1월 6일 (수) 오전 10:04, Chao Yu <yuchao0@huawei.com>님이 작성:
>
> Daeho,
>
> FYI
>
> https://www.spinics.net/lists/kernel/msg3595944.html
>
> On 2021/1/5 20:04, Markus Elfring wrote:
> >> Fixed null page reference when find_lock_page() fails in
> >> redirty_blocks().
> >
> > I suggest to choose an other imperative wording for this change description.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n89
> >
> >
> >> v2: changed error value and break the loop when error occurs
> >
> > I propose to use a return statement instead of a break in the second if branch
> > for this function implementation.
> >
> > See also:
> > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?id=36bbbd0e234d817938bdc52121a0f5473b3e58f5#n481
> >
> > Regards,
> > Markus
> >
> >
> > _______________________________________________
> > Linux-f2fs-devel mailing list
> > Linux-f2fs-devel@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
> > .
> >
>
>
> _______________________________________________
> Linux-f2fs-devel mailing list
> Linux-f2fs-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

* [f2fs-dev] [PATCH v2] f2fs: fix null page reference in redirty_blocks
@ 2021-01-05 23:49 Daeho Jeong
  0 siblings, 0 replies; 17+ messages in thread
From: Daeho Jeong @ 2021-01-05 23:49 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel, kernel-team; +Cc: Colin Ian King, Daeho Jeong

From: Daeho Jeong <daehojeong@google.com>

By Colin's static analysis, we found out there is a null page reference
under low memory situation in redirty_blocks. I've made the page finding
loop stop immediately and return an error not to cause further memory
pressure when we run into a failure to find a page under low memory
condition.

Signed-off-by: Daeho Jeong <daehojeong@google.com>
Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
---
v2: changed error value and quit the page finding loop immediately
    when error occurs
---
 fs/f2fs/file.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 9e5275716be8..d27173c24391 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -4060,8 +4060,10 @@ static int redirty_blocks(struct inode *inode, pgoff_t page_idx, int len)
 
 	for (i = 0; i < page_len; i++, redirty_idx++) {
 		page = find_lock_page(mapping, redirty_idx);
-		if (!page)
-			ret = -ENOENT;
+		if (!page) {
+			ret = -ENOMEM;
+			break;
+		}
 		set_page_dirty(page);
 		f2fs_put_page(page, 1);
 		f2fs_put_page(page, 0);
-- 
2.29.2.729.g45daf8777d-goog



_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

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

end of thread, other threads:[~2021-01-06  3:37 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05  4:16 [PATCH v2] f2fs: fix null page reference in redirty_blocks Daeho Jeong
2021-01-05  4:16 ` [f2fs-dev] " Daeho Jeong
2021-01-05  6:05 ` Chao Yu
2021-01-05  6:05   ` Chao Yu
2021-01-05  9:34 ` Colin Ian King
2021-01-05  9:34   ` [f2fs-dev] " Colin Ian King
2021-01-05 12:04 ` Markus Elfring
2021-01-05 23:44   ` Daeho Jeong
2021-01-05 23:44     ` Daeho Jeong
2021-01-05 23:44     ` Daeho Jeong
2021-01-06  1:03   ` Chao Yu
2021-01-06  1:03     ` Chao Yu
2021-01-06  1:03     ` Chao Yu
2021-01-06  3:35     ` Daeho Jeong
2021-01-06  3:35       ` Daeho Jeong
2021-01-06  3:35       ` Daeho Jeong
2021-01-05 23:49 Daeho Jeong

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.