lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210306033109.28466-1-hsiangkao@aol.com>
Date:   Sat,  6 Mar 2021 11:31:09 +0800
From:   Gao Xiang <hsiangkao@....com>
To:     linux-erofs@...ts.ozlabs.org, Chao Yu <yuchao0@...wei.com>,
        Chao Yu <chao@...nel.org>
Cc:     linux-kernel@...r.kernel.org, Gao Xiang <hsiangkao@...hat.com>,
        Martin DEVERA <devik@...labs.cz>
Subject: [PATCH] erofs: fix bio->bi_max_vecs behavior change

From: Gao Xiang <hsiangkao@...hat.com>

Martin reported an issue that directory read could be hung on the
latest -rc kernel with some certain image. The root cause is that
commit baa2c7c97153 ("block: set .bi_max_vecs as actual allocated
vector number") changes .bi_max_vecs behavior. bio->bi_max_vecs
is set as actual allocated vector number rather than the requested
number now.
Let's avoid using .bi_max_vecs completely instead.

Reported-by: Martin DEVERA <devik@...labs.cz>
Signed-off-by: Gao Xiang <hsiangkao@...hat.com>
---
Hi Chao,

Could you take some time on reviewing this patchset in advance?
I'd like to upstream this regression fix asap since it has noticable
impact on 5.12-rc kernel.

Thanks,
Gao Xiang

 fs/erofs/data.c | 13 ++-----------
 1 file changed, 2 insertions(+), 11 deletions(-)

diff --git a/fs/erofs/data.c b/fs/erofs/data.c
index f88851c5c250..fa25d0eab5de 100644
--- a/fs/erofs/data.c
+++ b/fs/erofs/data.c
@@ -231,14 +231,6 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
 		goto submit_bio_retry;
 
 	*last_block = current_block;
-
-	/* shift in advance in case of it followed by too many gaps */
-	if (bio->bi_iter.bi_size >= bio->bi_max_vecs * PAGE_SIZE) {
-		/* err should reassign to 0 after submitting */
-		err = 0;
-		goto submit_bio_out;
-	}
-
 	return bio;
 
 err_out:
@@ -252,7 +244,6 @@ static inline struct bio *erofs_read_raw_page(struct bio *bio,
 
 	/* if updated manually, continuous pages has a gap */
 	if (bio)
-submit_bio_out:
 		submit_bio(bio);
 	return err ? ERR_PTR(err) : NULL;
 }
@@ -274,7 +265,8 @@ static int erofs_raw_access_readpage(struct file *file, struct page *page)
 	if (IS_ERR(bio))
 		return PTR_ERR(bio);
 
-	DBG_BUGON(bio);	/* since we have only one bio -- must be NULL */
+	if (bio)
+		submit_bio(bio);
 	return 0;
 }
 
@@ -305,7 +297,6 @@ static void erofs_raw_access_readahead(struct readahead_control *rac)
 		put_page(page);
 	}
 
-	/* the rare case (end in gaps) */
 	if (bio)
 		submit_bio(bio);
 }
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ