[Devel] [PATCH RESEND 2/4] fuse kio: Check for null ep in pcs_rpc_deaccount_msg()

Kirill Tkhai ktkhai at virtuozzo.com
Wed Oct 17 12:08:06 MSK 2018


This is the only msg->done() callback related function,
which does not check for ep != NULL. Despite all the
creators of a msg with such msg->destruct() method
(it's called in order msg->done --> msg->destruct())
take ep counter before they create such type the msg,
add a explicit check for that to catch hidden msg
cloning and other not obvious actions on msg.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 fs/fuse/kio/pcs/pcs_rpc.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/fs/fuse/kio/pcs/pcs_rpc.c b/fs/fuse/kio/pcs/pcs_rpc.c
index 27156a507a84..8c76bb44f0a2 100644
--- a/fs/fuse/kio/pcs/pcs_rpc.c
+++ b/fs/fuse/kio/pcs/pcs_rpc.c
@@ -1083,7 +1083,10 @@ static int rpc_check_memlimit(struct pcs_rpc * ep)
 
 void pcs_rpc_deaccount_msg(struct pcs_msg * msg)
 {
-	struct pcs_rpc * ep = msg->rpc;
+	struct pcs_rpc *ep = msg->rpc;
+
+	if (WARN_ON_ONCE(!ep))
+		return;
 
 	msg->rpc = NULL;
 	ep->eng->msg_count--;



More information about the Devel mailing list