From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EE0E26B0B5; Thu, 13 Feb 2025 14:58:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458729; cv=none; b=WCJ7uiAQOY3hzxW+8XCu6WscuTyuDAZ45trzMJmPuKKZs13EFO7ZDdQHgMHVjZr65C19lYHcidAqsxT99ux8+oLb9D2SoQMs9mAZmbwm9SWqgo1FHjhSPwTK0WDMZEOGdMmcnjkijJ3Gb3UZ0AYgNplIUhTgYlyEmtw2+P0CW+0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1739458729; c=relaxed/simple; bh=S2+2xxaL9wArD+5rDmndAbt7yfidM07z2gg6liHKmF0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Sm98j305/DcwrYCMTHhBpPRzSr44mVJCnLGqVBMLBcHLrLkWquOqMbb6xo9axdQv8kFHVCHHN3zsI3bJh3C6vpdPXnCX7wJf8KPf8jlQ2genb6Obs4oXU9pfJkwG6UsBERThmqNJRAmDIpc1qGFvUa44YN15wO9WGFECGsSx+0w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Qn8bMFwS; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="Qn8bMFwS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 906C6C4CED1; Thu, 13 Feb 2025 14:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1739458729; bh=S2+2xxaL9wArD+5rDmndAbt7yfidM07z2gg6liHKmF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qn8bMFwS0MiNGFVf3TQQZqML+ytcu+YfQq0SDP1pL+WfQFYP3ZsF1sQ9o88X2SNEn cvZAR+Q1+no2SC95mmzVzrz6qiRygsIbXPDW9mOGOOKQXoaFwEwbLyAyx4kc+LPuE/ qPTkEY6Gnds6ShGHueP2qo6Qo6N6D6jd6l2iq8q0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+7536f77535e5210a5c76@syzkaller.appspotmail.com, Leo Stone , Tetsuo Handa , Sasha Levin Subject: [PATCH 6.13 060/443] tomoyo: dont emit warning in tomoyo_write_control() Date: Thu, 13 Feb 2025 15:23:45 +0100 Message-ID: <20250213142442.938277905@linuxfoundation.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20250213142440.609878115@linuxfoundation.org> References: <20250213142440.609878115@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.13-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tetsuo Handa [ Upstream commit 3df7546fc03b8f004eee0b9e3256369f7d096685 ] syzbot is reporting too large allocation warning at tomoyo_write_control(), for one can write a very very long line without new line character. To fix this warning, I use __GFP_NOWARN rather than checking for KMALLOC_MAX_SIZE, for practically a valid line should be always shorter than 32KB where the "too small to fail" memory-allocation rule applies. One might try to write a valid line that is longer than 32KB, but such request will likely fail with -ENOMEM. Therefore, I feel that separately returning -EINVAL when a line is longer than KMALLOC_MAX_SIZE is redundant. There is no need to distinguish over-32KB and over-KMALLOC_MAX_SIZE. Reported-by: syzbot+7536f77535e5210a5c76@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=7536f77535e5210a5c76 Reported-by: Leo Stone Closes: https://lkml.kernel.org/r/20241216021459.178759-2-leocstone@gmail.com Signed-off-by: Tetsuo Handa Signed-off-by: Sasha Levin --- security/tomoyo/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/tomoyo/common.c b/security/tomoyo/common.c index 5c7b059a332aa..972664962e8f6 100644 --- a/security/tomoyo/common.c +++ b/security/tomoyo/common.c @@ -2665,7 +2665,7 @@ ssize_t tomoyo_write_control(struct tomoyo_io_buffer *head, if (head->w.avail >= head->writebuf_size - 1) { const int len = head->writebuf_size * 2; - char *cp = kzalloc(len, GFP_NOFS); + char *cp = kzalloc(len, GFP_NOFS | __GFP_NOWARN); if (!cp) { error = -ENOMEM; -- 2.39.5