[Devel] [PATCH RHEL9 COMMIT] fs/fuse kio: convert BUG_ON check to error handling
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Mar 28 00:19:15 MSK 2025
The commit is pushed to "branch-rh9-5.14.0-427.44.1.vz9.80.x-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh9-5.14.0-427.44.1.vz9.80.22
------>
commit c7c6b9d910e80fdbfb43e1abf057e6f00358f51b
Author: Liu Kui <kui.liu at virtuozzo.com>
Date: Thu Mar 27 22:45:52 2025 +0800
fs/fuse kio: convert BUG_ON check to error handling
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: 0f8ffab52203 ("fs/fuse kio: implement pcs_krpc - export kernel RPC to
userspace")
https://virtuozzo.atlassian.net/browse/VSTOR-102865
Signed-off-by: Liu Kui <kui.liu at virtuozzo.com>
Acked-by: Alexey Kuznetsov <kuznet at virtuozzo.com>
Feature: fuse: kRPC - single RPC for kernel and userspace
---
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);
More information about the Devel
mailing list