v9fs.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Fedor Pchelkin <pchelkin@ispras.ru>
To: Dominique Martinet <asmadeus@codewreck.org>,
	Christian Schoenebeck <linux_oss@crudebyte.com>
Cc: Fedor Pchelkin <pchelkin@ispras.ru>,
	Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>,
	v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	Alexey Khoroshilov <khoroshilov@ispras.ru>,
	lvc-project@linuxtesting.org,
	syzbot+56fdf7f6291d819b9b19@syzkaller.appspotmail.com,
	syzbot+a83dc51a78f0f4cf20da@syzkaller.appspotmail.com,
	Pavel Skripkin <paskripkin@gmail.com>
Subject: [PATCH] fs: 9p: avoid warning during xattr allocation
Date: Fri,  2 Feb 2024 15:13:17 +0300	[thread overview]
Message-ID: <20240202121319.21743-1-pchelkin@ispras.ru> (raw)

An invalid server may reply with an xattr size which still fits into
ssize_t but is large enough to cause splat during kzalloc().

Add __GFP_NOWARN flag for the allocation. It seems client side can't do
much more about sanity checking here so it's better to return ENOMEM
silently.

Found by Linux Verification Center (linuxtesting.org) with Syzkaller.

Fixes: 85ff872d3f4a ("fs/9p: Implement POSIX ACL permission checking function")
Reported-by: syzbot+56fdf7f6291d819b9b19@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/000000000000789bcd05c9aa3d5d@google.com/
Reported-by: syzbot+a83dc51a78f0f4cf20da@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/00000000000086a03405eec3a706@google.com/
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
 fs/9p/acl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index eed551d8555f..e19a46192d2e 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -29,7 +29,7 @@ static struct posix_acl *v9fs_fid_get_acl(struct p9_fid *fid, const char *name)
 	if (size == 0)
 		return ERR_PTR(-ENODATA);
 
-	value = kzalloc(size, GFP_NOFS);
+	value = kzalloc(size, GFP_NOFS | __GFP_NOWARN);
 	if (!value)
 		return ERR_PTR(-ENOMEM);
 
-- 
2.43.0


             reply	other threads:[~2024-02-02 12:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-02 12:13 Fedor Pchelkin [this message]
2024-03-04 13:09 ` [PATCH] fs: 9p: avoid warning during xattr allocation Dominique Martinet
2024-03-04 21:19   ` Fedor Pchelkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240202121319.21743-1-pchelkin@ispras.ru \
    --to=pchelkin@ispras.ru \
    --cc=aneesh.kumar@linux.vnet.ibm.com \
    --cc=asmadeus@codewreck.org \
    --cc=ericvh@kernel.org \
    --cc=jvrao@linux.vnet.ibm.com \
    --cc=khoroshilov@ispras.ru \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=lvc-project@linuxtesting.org \
    --cc=paskripkin@gmail.com \
    --cc=syzbot+56fdf7f6291d819b9b19@syzkaller.appspotmail.com \
    --cc=syzbot+a83dc51a78f0f4cf20da@syzkaller.appspotmail.com \
    --cc=v9fs@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).