Re: [PATCH v19 14/17] netfs: Switch folioq to bvecq
From: David Howells
Date: Thu Nov 19 2026 - 06:50:25 EST
Hi Christian,
If you apply this patch, can you apply the attached change to it to fix a
potential NULL deref spotted by Sashiko[1]?
Thanks,
David
[1] https://sashiko.dev/#/patchset/20261119083851.3306418-1-dhowells%40redhat.com
---
diff --git a/fs/netfs/buffered_read.c b/fs/netfs/buffered_read.c
index 852b2cb73435..d229e797ef23 100644
--- a/fs/netfs/buffered_read.c
+++ b/fs/netfs/buffered_read.c
@@ -277,14 +277,15 @@ static void netfs_read_to_pagecache(struct netfs_io_request *rreq)
.cached_to[1] = ULLONG_MAX,
};
struct fscache_occupancy *occ = &_occ;
- struct bvecq *mark_bq = rreq->buffer.tail, *mark_pin;
+ struct bvecq *mark_bq = rreq->buffer.tail, *mark_pin = NULL;
unsigned int mark_offset = 0;
ssize_t size = rreq->len;
uoff_t start = rreq->start;
int ret = 0, mark_slot = 0;
/* Pin the bvecq whilst we mark folios for copying to the cache. */
- mark_pin = bvecq_get(mark_bq);
+ if (mark_bq)
+ mark_pin = bvecq_get(mark_bq);
do {
int (*prepare_read)(struct netfs_io_subrequest *subreq) = NULL;