[PATCH v8 1/6] liveupdate: reject LIVEUPDATE_IOCTL_CREATE_SESSION with invalid name length

From: luca . boccassi

Date: Sat Apr 18 2026 - 12:36:10 EST


From: Luca Boccassi <luca.boccassi@xxxxxxxxx>

A session name must not be an empty string, and must not exceed the
maximum size define in the uapi header, including null termination.

Fixes: 0153094d03df ("liveupdate: luo_session: add sessions support")

Signed-off-by: Luca Boccassi <luca.boccassi@xxxxxxxxx>
---
kernel/liveupdate/luo_session.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/kernel/liveupdate/luo_session.c b/kernel/liveupdate/luo_session.c
index 25ae704d7787..5e316a4c5d71 100644
--- a/kernel/liveupdate/luo_session.c
+++ b/kernel/liveupdate/luo_session.c
@@ -382,9 +382,13 @@ static int luo_session_getfile(struct luo_session *session, struct file **filep)

int luo_session_create(const char *name, struct file **filep)
{
+ size_t len = strnlen(name, LIVEUPDATE_SESSION_NAME_LENGTH);
struct luo_session *session;
int err;

+ if (len == 0 || len > LIVEUPDATE_SESSION_NAME_LENGTH - 1)
+ return -EINVAL;
+
session = luo_session_alloc(name);
if (IS_ERR(session))
return PTR_ERR(session);
--
2.47.3