From patchwork Fri Feb 2 12:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fedor Pchelkin X-Patchwork-Id: 195839 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp383056dyc; Fri, 2 Feb 2024 04:14:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEPxInV8DyQ68OpqkCvJgYjJOpla/ae1JVogbtKuQebNTxvOWZ7voA4/hiWCXNQwoBampah X-Received: by 2002:a05:6a21:1690:b0:19c:a980:58d6 with SMTP id np16-20020a056a21169000b0019ca98058d6mr2080792pzb.2.1706876099634; Fri, 02 Feb 2024 04:14:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706876099; cv=pass; d=google.com; s=arc-20160816; b=QjaQr5zv2KajOr+bfXhpBtzbBWTN5GkgbbjS5dpp8HNMKljGcmbfSPgLd1/NsnSV4z A4PLVGysZs9z7lzumU+KWGXBF4rQiFfXwk0jPDmp74ayZTHP6IpB86Uf0BuzY/eYcXJP 3S+mJqJi5dwepeW0448on16O0BLd5GhXTXk6KbbOfGXfN/zowdLN2iU+ftsIBEEfsTmC gyZCPQQBArra436ZeuhrJO39xCP4YoglaO3PTdi0+DOiOhDqvpl8RfaexPFoYA6/NS5N CxKdkqZLHOjAtBsXDeQ6Z5YSOvlunmIUwYh5YHv6S+4w+lyFPvCDbCznN/u2lt+oh768 vqfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature:dkim-filter; bh=eA0x4JCi+JyPKsZLcRH52SdlMvZD8FLMA9pRbfG8Ano=; fh=IUdC2qFJgV1mudb4N6fzoXyk3sc3gLnadQWZzKIcpac=; b=SF2c4pvxhQA5JbtKLaseP8yWmyYiUNOdWqd/71sEk5BTIb+x3sYMWnqXb0cEfcwwnu zT84MeJAryXb+EQCSHHiu3EFEs941NAtl7OPVtEb8Ez05S7YUZD8GgVk/xtPQnTy03Xf 73HOuh7TBVFlnJUBr/jUmEn6e3SPaAmJ1WTM78/WJ7xdyRQCJ/Hh7uU9C0L4zsVTkBGg XH3IcPWCdwFz1fZkOFBD88arVLV4GM6IxCH7FO75JAFnw55j8SUkP4k7IYBuTjWA2y5W TgdVBpaqWj/b0b4WNXKrI/Nh4lCJchklRzx/36+4ouwFPc8evQY+e14OXRnIyp3kKVAb crfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Lxb87qz2; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-49818-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49818-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru X-Forwarded-Encrypted: i=1; AJvYcCVl93r+TomzL86Bb8qSM4dfHt9Jc9DlhfGiszY/P+uqvKPeXLUg1jOH/XsEWVlnV6NFm3KeBPzJxv8QMGLKlvz1T3n7Ww== Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id q8-20020a635c08000000b005c625d44bd5si1504498pgb.281.2024.02.02.04.14.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 04:14:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49818-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@ispras.ru header.s=default header.b=Lxb87qz2; arc=pass (i=1 spf=pass spfdomain=ispras.ru dkim=pass dkdomain=ispras.ru dmarc=pass fromdomain=ispras.ru); spf=pass (google.com: domain of linux-kernel+bounces-49818-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49818-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ispras.ru Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 7A02A289927 for ; Fri, 2 Feb 2024 12:14:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 59FD314199C; Fri, 2 Feb 2024 12:13:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b="Lxb87qz2" Received: from mail.ispras.ru (mail.ispras.ru [83.149.199.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8E41914199F for ; Fri, 2 Feb 2024 12:13:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=83.149.199.84 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706876021; cv=none; b=FKhUbuw5r+AvOCIxin7PD3Z+pXo64dGusul+c5mBxh5lSMSrJVyVuR7FND6L8OynUcuBO9zx2zimqsExW0jrTzXACzKhFUqMtxzjC1SmLir43+u6aIh5wYPDJ7J4x97spfXt+e+NMfJNmUr/NB0GKQLpw5GNDFds4hM1+/cH8aI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706876021; c=relaxed/simple; bh=/MYz96hTgmyfUKN8lIz6Wn2kXH/W5xiuldsDugYBDUE=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=gO9rb3nXrQhYs+WrLACGRHyOwMuffPkvV6DQyXN9Z56hmFqGuA3W1/8nvJqWjlGYJK6DE3lkGXRi9io9DFscKQaPI8DeC78y14d0GkMmFlfU10xRfOqSCOvNpGev9lZPpx5BzS7kiVelPxLZO/vFFTfKLcbdaeuYSIPoAryDnbI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru; spf=pass smtp.mailfrom=ispras.ru; dkim=pass (1024-bit key) header.d=ispras.ru header.i=@ispras.ru header.b=Lxb87qz2; arc=none smtp.client-ip=83.149.199.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=ispras.ru Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ispras.ru Received: from localhost.ispras.ru (unknown [10.10.165.19]) by mail.ispras.ru (Postfix) with ESMTPSA id 96CEF40F1DFF; Fri, 2 Feb 2024 12:13:34 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 mail.ispras.ru 96CEF40F1DFF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ispras.ru; s=default; t=1706876014; bh=eA0x4JCi+JyPKsZLcRH52SdlMvZD8FLMA9pRbfG8Ano=; h=From:To:Cc:Subject:Date:From; b=Lxb87qz2ETojmszILfllYWsjKulf2HoQQ2pH6pW1jgMjUGenElWZsVzl45cgVNr0A sKxOtGaCxs/8+lsr8G8Fwr5zE+9VuX8VECkEA73KVIdeY8bzX/DR467QNniwXGxZpO /gAcpDzTDCP4pBUQGJNaZfLK9QUckjgxYFbVLh9A= From: Fedor Pchelkin To: Dominique Martinet , Christian Schoenebeck Cc: Fedor Pchelkin , Eric Van Hensbergen , Latchesar Ionkov , Venkateswararao Jujjuri , "Aneesh Kumar K.V" , v9fs@lists.linux.dev, linux-kernel@vger.kernel.org, Alexey Khoroshilov , lvc-project@linuxtesting.org, syzbot+56fdf7f6291d819b9b19@syzkaller.appspotmail.com, syzbot+a83dc51a78f0f4cf20da@syzkaller.appspotmail.com, Pavel Skripkin Subject: [PATCH] fs: 9p: avoid warning during xattr allocation Date: Fri, 2 Feb 2024 15:13:17 +0300 Message-ID: <20240202121319.21743-1-pchelkin@ispras.ru> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789789313470407441 X-GMAIL-MSGID: 1789789313470407441 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 Signed-off-by: Fedor Pchelkin --- 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);