[Devel] [PATCH VZ9] fs/fuse kio: convert BUG_ON check to error handling
Liu Kui
kui.liu at virtuozzo.com
Thu Mar 27 17:45:52 MSK 2025
The BUG_ON condition here is legitimate that can happen during fuse
connection teardown. So a fatal error should be returned instead of
crash.
Fixes #VSTOR-102865
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
---
fs/fuse/kio/pcs/pcs_krpc.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/fuse/kio/pcs/pcs_krpc.c b/fs/fuse/kio/pcs/pcs_krpc.c
index 115bd67aa0d2..323205a3e2df 100644
--- a/fs/fuse/kio/pcs/pcs_krpc.c
+++ b/fs/fuse/kio/pcs/pcs_krpc.c
@@ -486,7 +486,10 @@ static int pcs_krpc_ioctl_send_msg(struct pcs_krpc *krpc, struct pcs_krpc_ioc_se
chunk->type = KRPC_CHUNK_TYPE_MR;
chunk->mr = pcs_mr_get(&cc_from_krpc(krpc)->mrs, iocmsg->hdr_chunk.mr_id);
- BUG_ON(!chunk->mr);
+ if (!chunk->mr) {
+ res = -ENXIO;
+ goto err_free_data_chunk;
+ }
kreq->hdr_buf = (char *) kmap(pcs_umem_page(chunk->mr->umem, chunk->addr));
kreq->hdr_kv.iov_base = kreq->hdr_buf;
@@ -595,7 +598,8 @@ static int pcs_krpc_ioctl_send_msg(struct pcs_krpc *krpc, struct pcs_krpc_ioc_se
err_free_data_chunk:
kreq_release_data_chunks(kreq);
- pcs_mr_put(kreq->hdr_chunk.mr);
+ if (kreq->hdr_chunk.mr)
+ pcs_mr_put(kreq->hdr_chunk.mr);
err_free_kreq:
krpc_req_free(kreq);
--
2.39.5 (Apple Git-154)
More information about the Devel
mailing list