Re: [syzbot] Re: [syzbot] [tomoyo?] WARNING in tomoyo_write_control
From: syzbot
Date: Mon Dec 16 2024 - 02:19:20 EST
For archival purposes, forwarding an incoming command email to
linux-kernel@xxxxxxxxxxxxxxx.
***
Subject: Re: [syzbot] [tomoyo?] WARNING in tomoyo_write_control
Author: lizhi.xu@xxxxxxxxxxxxx
User input a too large avail length 0xfffffdeful.
#syz test
diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c
index 5c7b059a332a..d25752eb8790 100644
--- a/security/tomoyo/common.c
+++ b/security/tomoyo/common.c
@@ -2656,6 +2656,9 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head,
return -EINVAL;
if (mutex_lock_interruptible(&head->io_sem))
return -EINTR;
+ if (avail_len << PAGE_SHIFT > MAX_PAGE_ORDER)
+ return -EINVAL;
+
cp0 = head->write_buf;
head->read_user_buf_avail = 0;
idx = tomoyo_read_lock();