Patch "fsverity: don't use bio_first_page_all() in fsverity_verify_bio()" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    fsverity: don't use bio_first_page_all() in fsverity_verify_bio()

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     fsverity-don-t-use-bio_first_page_all-in-fsverity_ve.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c624ec2666cd52dba9f0c8e4e3df57320cc77eaf
Author: Eric Biggers <ebiggers@xxxxxxxxxx>
Date:   Sat Jun 3 19:21:01 2023 -0700

    fsverity: don't use bio_first_page_all() in fsverity_verify_bio()
    
    [ Upstream commit d1f0c5ea04cd0a93309de0246278f0b22394692d ]
    
    bio_first_page_all(bio)->mapping->host is not compatible with large
    folios, since the first page of the bio is not necessarily the head page
    of the folio, and therefore it might not have the mapping pointer set.
    
    Therefore, move the dereference of ->mapping->host into
    verify_data_blocks(), which works with a folio.
    
    (Like the commit that this Fixes, this hasn't actually been tested with
    large folios yet, since the filesystems that use fs/verity/ don't
    support that yet.  But based on code review, I think this is needed.)
    
    Fixes: 5d0f0e57ed90 ("fsverity: support verifying data from large folios")
    Link: https://lore.kernel.org/r/20230604022101.48342-1-ebiggers@xxxxxxxxxx
    Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
    Signed-off-by: Eric Biggers <ebiggers@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index e9ae1eef5f191..cf40e2fe6ace7 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -256,9 +256,10 @@ verify_data_block(struct inode *inode, struct fsverity_info *vi,
 }
 
 static bool
-verify_data_blocks(struct inode *inode, struct folio *data_folio,
-		   size_t len, size_t offset, unsigned long max_ra_pages)
+verify_data_blocks(struct folio *data_folio, size_t len, size_t offset,
+		   unsigned long max_ra_pages)
 {
+	struct inode *inode = data_folio->mapping->host;
 	struct fsverity_info *vi = inode->i_verity_info;
 	const unsigned int block_size = vi->tree_params.block_size;
 	u64 pos = (u64)data_folio->index << PAGE_SHIFT;
@@ -298,7 +299,7 @@ verify_data_blocks(struct inode *inode, struct folio *data_folio,
  */
 bool fsverity_verify_blocks(struct folio *folio, size_t len, size_t offset)
 {
-	return verify_data_blocks(folio->mapping->host, folio, len, offset, 0);
+	return verify_data_blocks(folio, len, offset, 0);
 }
 EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
 
@@ -319,7 +320,6 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
  */
 void fsverity_verify_bio(struct bio *bio)
 {
-	struct inode *inode = bio_first_page_all(bio)->mapping->host;
 	struct folio_iter fi;
 	unsigned long max_ra_pages = 0;
 
@@ -337,7 +337,7 @@ void fsverity_verify_bio(struct bio *bio)
 	}
 
 	bio_for_each_folio_all(fi, bio) {
-		if (!verify_data_blocks(inode, fi.folio, fi.length, fi.offset,
+		if (!verify_data_blocks(fi.folio, fi.length, fi.offset,
 					max_ra_pages)) {
 			bio->bi_status = BLK_STS_IOERR;
 			break;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux