From: Hongling Zeng Date: Wed, 13 May 2026 09:28:59 +0000 (+0800) Subject: sunrpc: Fix error handling in rpc_sysfs_xprt_switch_add_xprt_store() X-Git-Tag: v7.2-rc1~46^2~37 X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=37957478be021b92981aa4c99b69f308d3b784d0;p=thirdparty%2Fkernel%2Flinux.git sunrpc: Fix error handling in rpc_sysfs_xprt_switch_add_xprt_store() xprt_create_transport() never returns NULL, only valid pointers or error pointers. Using IS_ERR_OR_NULL() is incorrect, and PTR_ERR(NULL) would return 0, which indicates EOF in a sysfs store function. Fix this by using IS_ERR() instead of IS_ERR_OR_NULL(). Fixes: df210d9b0951 ("sunrpc: Add a sysfs file for adding a new xprt") Signed-off-by: Hongling Zeng Signed-off-by: Anna Schumaker --- diff --git a/net/sunrpc/sysfs.c b/net/sunrpc/sysfs.c index a90480f801548..49686bf740e69 100644 --- a/net/sunrpc/sysfs.c +++ b/net/sunrpc/sysfs.c @@ -348,7 +348,7 @@ static ssize_t rpc_sysfs_xprt_switch_add_xprt_store(struct kobject *kobj, xprt_create_args.reconnect_timeout = xprt->max_reconnect_timeout; new = xprt_create_transport(&xprt_create_args); - if (IS_ERR_OR_NULL(new)) { + if (IS_ERR(new)) { count = PTR_ERR(new); goto out_put_xprt; }