All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] f2fs: avoid null pointer access when handling IPU error
@ 2021-05-10 14:28 ` Jaegeuk Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Jaegeuk Kim @ 2021-05-10 14:28 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

 Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
 pc : f2fs_inplace_write_data+0x144/0x208
 lr : f2fs_inplace_write_data+0x134/0x208
 Call trace:
  f2fs_inplace_write_data+0x144/0x208
  f2fs_do_write_data_page+0x270/0x770
  f2fs_write_single_data_page+0x47c/0x830
  __f2fs_write_data_pages+0x444/0x98c
  f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
  do_writepages+0x58/0x118
  __writeback_single_inode+0x44/0x300
  writeback_sb_inodes+0x4b8/0x9c8
  wb_writeback+0x148/0x42c
  wb_do_writeback+0xc8/0x390
  wb_workfn+0xb0/0x2f4
  process_one_work+0x1fc/0x444
  worker_thread+0x268/0x4b4
  kthread+0x13c/0x158
  ret_from_fork+0x10/0x18

Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c605415840b5..ae875557d693 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 	if (fio->bio) {
 		struct bio *bio = *(fio->bio);
 
-		bio->bi_status = BLK_STS_IOERR;
-		bio_endio(bio);
-		fio->bio = NULL;
+		if (bio) {
+			bio->bi_status = BLK_STS_IOERR;
+			bio_endio(bio);
+			fio->bio = NULL;
+		}
 	}
 	return err;
 }
-- 
2.31.1.607.g51e8a6a459-goog


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

* [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
@ 2021-05-10 14:28 ` Jaegeuk Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Jaegeuk Kim @ 2021-05-10 14:28 UTC (permalink / raw)
  To: linux-kernel, linux-f2fs-devel; +Cc: Jaegeuk Kim

 Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
 pc : f2fs_inplace_write_data+0x144/0x208
 lr : f2fs_inplace_write_data+0x134/0x208
 Call trace:
  f2fs_inplace_write_data+0x144/0x208
  f2fs_do_write_data_page+0x270/0x770
  f2fs_write_single_data_page+0x47c/0x830
  __f2fs_write_data_pages+0x444/0x98c
  f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
  do_writepages+0x58/0x118
  __writeback_single_inode+0x44/0x300
  writeback_sb_inodes+0x4b8/0x9c8
  wb_writeback+0x148/0x42c
  wb_do_writeback+0xc8/0x390
  wb_workfn+0xb0/0x2f4
  process_one_work+0x1fc/0x444
  worker_thread+0x268/0x4b4
  kthread+0x13c/0x158
  ret_from_fork+0x10/0x18

Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c605415840b5..ae875557d693 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 	if (fio->bio) {
 		struct bio *bio = *(fio->bio);
 
-		bio->bi_status = BLK_STS_IOERR;
-		bio_endio(bio);
-		fio->bio = NULL;
+		if (bio) {
+			bio->bi_status = BLK_STS_IOERR;
+			bio_endio(bio);
+			fio->bio = NULL;
+		}
 	}
 	return err;
 }
-- 
2.31.1.607.g51e8a6a459-goog



_______________________________________________
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] 8+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
  2021-05-10 14:28 ` [f2fs-dev] " Jaegeuk Kim
@ 2021-05-11  1:29   ` Chao Yu
  -1 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2021-05-11  1:29 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2021/5/10 22:28, Jaegeuk Kim wrote:
>   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>   pc : f2fs_inplace_write_data+0x144/0x208
>   lr : f2fs_inplace_write_data+0x134/0x208
>   Call trace:
>    f2fs_inplace_write_data+0x144/0x208
>    f2fs_do_write_data_page+0x270/0x770
>    f2fs_write_single_data_page+0x47c/0x830
>    __f2fs_write_data_pages+0x444/0x98c
>    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>    do_writepages+0x58/0x118
>    __writeback_single_inode+0x44/0x300
>    writeback_sb_inodes+0x4b8/0x9c8
>    wb_writeback+0x148/0x42c
>    wb_do_writeback+0xc8/0x390
>    wb_workfn+0xb0/0x2f4
>    process_one_work+0x1fc/0x444
>    worker_thread+0x268/0x4b4
>    kthread+0x13c/0x158
>    ret_from_fork+0x10/0x18
> 
> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")

My bad, thanks for fixing this.

> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/segment.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index c605415840b5..ae875557d693 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>   	if (fio->bio) {
>   		struct bio *bio = *(fio->bio);
>   
> -		bio->bi_status = BLK_STS_IOERR;
> -		bio_endio(bio);
> -		fio->bio = NULL;
> +		if (bio) {
> +			bio->bi_status = BLK_STS_IOERR;
> +			bio_endio(bio);
> +			fio->bio = NULL;

fio->bio points a bio assigned in writepages(), so it should reset
that bio to NULL by *(fio->bio) = NULL.

Thanks,

> +		}
>   	}
>   	return err;
>   }
> 

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

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
@ 2021-05-11  1:29   ` Chao Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2021-05-11  1:29 UTC (permalink / raw)
  To: Jaegeuk Kim, linux-kernel, linux-f2fs-devel

On 2021/5/10 22:28, Jaegeuk Kim wrote:
>   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>   pc : f2fs_inplace_write_data+0x144/0x208
>   lr : f2fs_inplace_write_data+0x134/0x208
>   Call trace:
>    f2fs_inplace_write_data+0x144/0x208
>    f2fs_do_write_data_page+0x270/0x770
>    f2fs_write_single_data_page+0x47c/0x830
>    __f2fs_write_data_pages+0x444/0x98c
>    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>    do_writepages+0x58/0x118
>    __writeback_single_inode+0x44/0x300
>    writeback_sb_inodes+0x4b8/0x9c8
>    wb_writeback+0x148/0x42c
>    wb_do_writeback+0xc8/0x390
>    wb_workfn+0xb0/0x2f4
>    process_one_work+0x1fc/0x444
>    worker_thread+0x268/0x4b4
>    kthread+0x13c/0x158
>    ret_from_fork+0x10/0x18
> 
> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")

My bad, thanks for fixing this.

> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> ---
>   fs/f2fs/segment.c | 8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> index c605415840b5..ae875557d693 100644
> --- a/fs/f2fs/segment.c
> +++ b/fs/f2fs/segment.c
> @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>   	if (fio->bio) {
>   		struct bio *bio = *(fio->bio);
>   
> -		bio->bi_status = BLK_STS_IOERR;
> -		bio_endio(bio);
> -		fio->bio = NULL;
> +		if (bio) {
> +			bio->bi_status = BLK_STS_IOERR;
> +			bio_endio(bio);
> +			fio->bio = NULL;

fio->bio points a bio assigned in writepages(), so it should reset
that bio to NULL by *(fio->bio) = NULL.

Thanks,

> +		}
>   	}
>   	return err;
>   }
> 


_______________________________________________
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] 8+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
  2021-05-11  1:29   ` Chao Yu
@ 2021-05-11  5:07     ` Jaegeuk Kim
  -1 siblings, 0 replies; 8+ messages in thread
From: Jaegeuk Kim @ 2021-05-11  5:07 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 05/11, Chao Yu wrote:
> On 2021/5/10 22:28, Jaegeuk Kim wrote:
> >   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
> >   pc : f2fs_inplace_write_data+0x144/0x208
> >   lr : f2fs_inplace_write_data+0x134/0x208
> >   Call trace:
> >    f2fs_inplace_write_data+0x144/0x208
> >    f2fs_do_write_data_page+0x270/0x770
> >    f2fs_write_single_data_page+0x47c/0x830
> >    __f2fs_write_data_pages+0x444/0x98c
> >    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
> >    do_writepages+0x58/0x118
> >    __writeback_single_inode+0x44/0x300
> >    writeback_sb_inodes+0x4b8/0x9c8
> >    wb_writeback+0x148/0x42c
> >    wb_do_writeback+0xc8/0x390
> >    wb_workfn+0xb0/0x2f4
> >    process_one_work+0x1fc/0x444
> >    worker_thread+0x268/0x4b4
> >    kthread+0x13c/0x158
> >    ret_from_fork+0x10/0x18
> > 
> > Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
> 
> My bad, thanks for fixing this.
> 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >   fs/f2fs/segment.c | 8 +++++---
> >   1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index c605415840b5..ae875557d693 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
> >   	if (fio->bio) {
> >   		struct bio *bio = *(fio->bio);
> > -		bio->bi_status = BLK_STS_IOERR;
> > -		bio_endio(bio);
> > -		fio->bio = NULL;
> > +		if (bio) {
> > +			bio->bi_status = BLK_STS_IOERR;
> > +			bio_endio(bio);
> > +			fio->bio = NULL;
> 
> fio->bio points a bio assigned in writepages(), so it should reset
> that bio to NULL by *(fio->bio) = NULL.

Good timing. I hit other kernel panic, and it seems this is the root cause.
Let me give it a try. :)

--- v2 ---

 Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
 pc : f2fs_inplace_write_data+0x144/0x208
 lr : f2fs_inplace_write_data+0x134/0x208
 Call trace:
  f2fs_inplace_write_data+0x144/0x208
  f2fs_do_write_data_page+0x270/0x770
  f2fs_write_single_data_page+0x47c/0x830
  __f2fs_write_data_pages+0x444/0x98c
  f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
  do_writepages+0x58/0x118
  __writeback_single_inode+0x44/0x300
  writeback_sb_inodes+0x4b8/0x9c8
  wb_writeback+0x148/0x42c
  wb_do_writeback+0xc8/0x390
  wb_workfn+0xb0/0x2f4
  process_one_work+0x1fc/0x444
  worker_thread+0x268/0x4b4
  kthread+0x13c/0x158
  ret_from_fork+0x10/0x18

Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c605415840b5..51dc79fad4fe 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3574,12 +3574,12 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 
 	return err;
 drop_bio:
-	if (fio->bio) {
+	if (fio->bio && *(fio->bio)) {
 		struct bio *bio = *(fio->bio);
 
 		bio->bi_status = BLK_STS_IOERR;
 		bio_endio(bio);
-		fio->bio = NULL;
+		*(fio->bio) = NULL;
 	}
 	return err;
 }
-- 
2.31.1.607.g51e8a6a459-goog


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

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
@ 2021-05-11  5:07     ` Jaegeuk Kim
  0 siblings, 0 replies; 8+ messages in thread
From: Jaegeuk Kim @ 2021-05-11  5:07 UTC (permalink / raw)
  To: Chao Yu; +Cc: linux-kernel, linux-f2fs-devel

On 05/11, Chao Yu wrote:
> On 2021/5/10 22:28, Jaegeuk Kim wrote:
> >   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
> >   pc : f2fs_inplace_write_data+0x144/0x208
> >   lr : f2fs_inplace_write_data+0x134/0x208
> >   Call trace:
> >    f2fs_inplace_write_data+0x144/0x208
> >    f2fs_do_write_data_page+0x270/0x770
> >    f2fs_write_single_data_page+0x47c/0x830
> >    __f2fs_write_data_pages+0x444/0x98c
> >    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
> >    do_writepages+0x58/0x118
> >    __writeback_single_inode+0x44/0x300
> >    writeback_sb_inodes+0x4b8/0x9c8
> >    wb_writeback+0x148/0x42c
> >    wb_do_writeback+0xc8/0x390
> >    wb_workfn+0xb0/0x2f4
> >    process_one_work+0x1fc/0x444
> >    worker_thread+0x268/0x4b4
> >    kthread+0x13c/0x158
> >    ret_from_fork+0x10/0x18
> > 
> > Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
> 
> My bad, thanks for fixing this.
> 
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> >   fs/f2fs/segment.c | 8 +++++---
> >   1 file changed, 5 insertions(+), 3 deletions(-)
> > 
> > diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
> > index c605415840b5..ae875557d693 100644
> > --- a/fs/f2fs/segment.c
> > +++ b/fs/f2fs/segment.c
> > @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
> >   	if (fio->bio) {
> >   		struct bio *bio = *(fio->bio);
> > -		bio->bi_status = BLK_STS_IOERR;
> > -		bio_endio(bio);
> > -		fio->bio = NULL;
> > +		if (bio) {
> > +			bio->bi_status = BLK_STS_IOERR;
> > +			bio_endio(bio);
> > +			fio->bio = NULL;
> 
> fio->bio points a bio assigned in writepages(), so it should reset
> that bio to NULL by *(fio->bio) = NULL.

Good timing. I hit other kernel panic, and it seems this is the root cause.
Let me give it a try. :)

--- v2 ---

 Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
 pc : f2fs_inplace_write_data+0x144/0x208
 lr : f2fs_inplace_write_data+0x134/0x208
 Call trace:
  f2fs_inplace_write_data+0x144/0x208
  f2fs_do_write_data_page+0x270/0x770
  f2fs_write_single_data_page+0x47c/0x830
  __f2fs_write_data_pages+0x444/0x98c
  f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
  do_writepages+0x58/0x118
  __writeback_single_inode+0x44/0x300
  writeback_sb_inodes+0x4b8/0x9c8
  wb_writeback+0x148/0x42c
  wb_do_writeback+0xc8/0x390
  wb_workfn+0xb0/0x2f4
  process_one_work+0x1fc/0x444
  worker_thread+0x268/0x4b4
  kthread+0x13c/0x158
  ret_from_fork+0x10/0x18

Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
---
 fs/f2fs/segment.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index c605415840b5..51dc79fad4fe 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -3574,12 +3574,12 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
 
 	return err;
 drop_bio:
-	if (fio->bio) {
+	if (fio->bio && *(fio->bio)) {
 		struct bio *bio = *(fio->bio);
 
 		bio->bi_status = BLK_STS_IOERR;
 		bio_endio(bio);
-		fio->bio = NULL;
+		*(fio->bio) = NULL;
 	}
 	return err;
 }
-- 
2.31.1.607.g51e8a6a459-goog



_______________________________________________
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] 8+ messages in thread

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
  2021-05-11  5:07     ` Jaegeuk Kim
@ 2021-05-11  6:02       ` Chao Yu
  -1 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2021-05-11  6:02 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2021/5/11 13:07, Jaegeuk Kim wrote:
> On 05/11, Chao Yu wrote:
>> On 2021/5/10 22:28, Jaegeuk Kim wrote:
>>>    Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>>>    pc : f2fs_inplace_write_data+0x144/0x208
>>>    lr : f2fs_inplace_write_data+0x134/0x208
>>>    Call trace:
>>>     f2fs_inplace_write_data+0x144/0x208
>>>     f2fs_do_write_data_page+0x270/0x770
>>>     f2fs_write_single_data_page+0x47c/0x830
>>>     __f2fs_write_data_pages+0x444/0x98c
>>>     f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>>>     do_writepages+0x58/0x118
>>>     __writeback_single_inode+0x44/0x300
>>>     writeback_sb_inodes+0x4b8/0x9c8
>>>     wb_writeback+0x148/0x42c
>>>     wb_do_writeback+0xc8/0x390
>>>     wb_workfn+0xb0/0x2f4
>>>     process_one_work+0x1fc/0x444
>>>     worker_thread+0x268/0x4b4
>>>     kthread+0x13c/0x158
>>>     ret_from_fork+0x10/0x18
>>>
>>> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
>>
>> My bad, thanks for fixing this.
>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>    fs/f2fs/segment.c | 8 +++++---
>>>    1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index c605415840b5..ae875557d693 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>>>    	if (fio->bio) {
>>>    		struct bio *bio = *(fio->bio);
>>> -		bio->bi_status = BLK_STS_IOERR;
>>> -		bio_endio(bio);
>>> -		fio->bio = NULL;
>>> +		if (bio) {
>>> +			bio->bi_status = BLK_STS_IOERR;
>>> +			bio_endio(bio);
>>> +			fio->bio = NULL;
>>
>> fio->bio points a bio assigned in writepages(), so it should reset
>> that bio to NULL by *(fio->bio) = NULL.
> 
> Good timing. I hit other kernel panic, and it seems this is the root cause.
> Let me give it a try. :)
> 
> --- v2 ---
> 
>   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>   pc : f2fs_inplace_write_data+0x144/0x208
>   lr : f2fs_inplace_write_data+0x134/0x208
>   Call trace:
>    f2fs_inplace_write_data+0x144/0x208
>    f2fs_do_write_data_page+0x270/0x770
>    f2fs_write_single_data_page+0x47c/0x830
>    __f2fs_write_data_pages+0x444/0x98c
>    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>    do_writepages+0x58/0x118
>    __writeback_single_inode+0x44/0x300
>    writeback_sb_inodes+0x4b8/0x9c8
>    wb_writeback+0x148/0x42c
>    wb_do_writeback+0xc8/0x390
>    wb_workfn+0xb0/0x2f4
>    process_one_work+0x1fc/0x444
>    worker_thread+0x268/0x4b4
>    kthread+0x13c/0x158
>    ret_from_fork+0x10/0x18
> 
> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

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

Thanks,

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

* Re: [f2fs-dev] [PATCH] f2fs: avoid null pointer access when handling IPU error
@ 2021-05-11  6:02       ` Chao Yu
  0 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2021-05-11  6:02 UTC (permalink / raw)
  To: Jaegeuk Kim; +Cc: linux-kernel, linux-f2fs-devel

On 2021/5/11 13:07, Jaegeuk Kim wrote:
> On 05/11, Chao Yu wrote:
>> On 2021/5/10 22:28, Jaegeuk Kim wrote:
>>>    Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>>>    pc : f2fs_inplace_write_data+0x144/0x208
>>>    lr : f2fs_inplace_write_data+0x134/0x208
>>>    Call trace:
>>>     f2fs_inplace_write_data+0x144/0x208
>>>     f2fs_do_write_data_page+0x270/0x770
>>>     f2fs_write_single_data_page+0x47c/0x830
>>>     __f2fs_write_data_pages+0x444/0x98c
>>>     f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>>>     do_writepages+0x58/0x118
>>>     __writeback_single_inode+0x44/0x300
>>>     writeback_sb_inodes+0x4b8/0x9c8
>>>     wb_writeback+0x148/0x42c
>>>     wb_do_writeback+0xc8/0x390
>>>     wb_workfn+0xb0/0x2f4
>>>     process_one_work+0x1fc/0x444
>>>     worker_thread+0x268/0x4b4
>>>     kthread+0x13c/0x158
>>>     ret_from_fork+0x10/0x18
>>>
>>> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
>>
>> My bad, thanks for fixing this.
>>
>>> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
>>> ---
>>>    fs/f2fs/segment.c | 8 +++++---
>>>    1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
>>> index c605415840b5..ae875557d693 100644
>>> --- a/fs/f2fs/segment.c
>>> +++ b/fs/f2fs/segment.c
>>> @@ -3577,9 +3577,11 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
>>>    	if (fio->bio) {
>>>    		struct bio *bio = *(fio->bio);
>>> -		bio->bi_status = BLK_STS_IOERR;
>>> -		bio_endio(bio);
>>> -		fio->bio = NULL;
>>> +		if (bio) {
>>> +			bio->bi_status = BLK_STS_IOERR;
>>> +			bio_endio(bio);
>>> +			fio->bio = NULL;
>>
>> fio->bio points a bio assigned in writepages(), so it should reset
>> that bio to NULL by *(fio->bio) = NULL.
> 
> Good timing. I hit other kernel panic, and it seems this is the root cause.
> Let me give it a try. :)
> 
> --- v2 ---
> 
>   Unable to handle kernel NULL pointer dereference at virtual address 000000000000001a
>   pc : f2fs_inplace_write_data+0x144/0x208
>   lr : f2fs_inplace_write_data+0x134/0x208
>   Call trace:
>    f2fs_inplace_write_data+0x144/0x208
>    f2fs_do_write_data_page+0x270/0x770
>    f2fs_write_single_data_page+0x47c/0x830
>    __f2fs_write_data_pages+0x444/0x98c
>    f2fs_write_data_pages.llvm.16514453770497736882+0x2c/0x38
>    do_writepages+0x58/0x118
>    __writeback_single_inode+0x44/0x300
>    writeback_sb_inodes+0x4b8/0x9c8
>    wb_writeback+0x148/0x42c
>    wb_do_writeback+0xc8/0x390
>    wb_workfn+0xb0/0x2f4
>    process_one_work+0x1fc/0x444
>    worker_thread+0x268/0x4b4
>    kthread+0x13c/0x158
>    ret_from_fork+0x10/0x18
> 
> Fixes: 955772787667 ("f2fs: drop inplace IO if fs status is abnormal")
> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

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] 8+ messages in thread

end of thread, other threads:[~2021-05-11  6:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 14:28 [PATCH] f2fs: avoid null pointer access when handling IPU error Jaegeuk Kim
2021-05-10 14:28 ` [f2fs-dev] " Jaegeuk Kim
2021-05-11  1:29 ` Chao Yu
2021-05-11  1:29   ` Chao Yu
2021-05-11  5:07   ` Jaegeuk Kim
2021-05-11  5:07     ` Jaegeuk Kim
2021-05-11  6:02     ` Chao Yu
2021-05-11  6:02       ` Chao Yu

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.