Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp648298pxv; Thu, 15 Jul 2021 12:25:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyi3gIJTsUS0TNlfM0wAI0f1ZBErJ3P/4s8mBUedUYCqZ6MMSAhOMViLiUKL+NkU/DZoT0C X-Received: by 2002:a17:906:7fcd:: with SMTP id r13mr7204326ejs.547.1626377116882; Thu, 15 Jul 2021 12:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626377116; cv=none; d=google.com; s=arc-20160816; b=mR4dqvlnba3BWLd5RjCe2BAEe62bJ+2ZKTkLaLCOtELWttJH8LPnY9XjuEUs1nIHgK HN22oJuckKG8YTByjzexSw0CHdVt637guQWqlHdmvIEiCZdnkktDg2Nh4TzPsQ3vsMpf /3V/7dO4fhSG/Y0quB9FFGLuvLlm0+n3qIqJ1gZgfqWBtX5vwoHmB1JyUkWRj+3T4lEH bIkVJbTqVpcbkI2yfNS2Vi3RDvTD4QQIaRsoSUANjMJ3NJWPda9YHhS4mn9JRUMElFBl 7qKSwR/L7uCR5xMQsb3VNazAWQ4pecVhJQpWby178Dw62HWjWaxMW14DV/ca0WZeqlxe Of+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lm+5NpQ/IusjgEbygkf47yPcpCeZXsJ9/9sGCUzA2eI=; b=bpebyjf2/NicJt/hjco/G1OyzP5PfVA5tPkSDqWDgmUrzsnVtXkAVfgMauveVEmfIW yljrfQ2yFtxLmD9WVhuXIOPyVfxKXPQah+1hQmzvtWfB+floX4Owg8nXapMUz+Ueejw5 ffU2KXeWC2afomxhLlz3gnw9w5M3/gmDTXg3tNMU3H/QBm274bcbNCnV8/C6sJtK9vGB 8DjxEOoUtXSCfQDz6E3sEGtBj+3sdyAZ09mY6P4SQkkNq06xnzsD7OSqVJPwAC9Losw8 eVx5gcis69jsewFkcH2PYHk6HmSfecIihmhjf2ugXLY9jngLIk0CxLRD1albU0Ug/1tc ZX8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SqIcS1ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z19si4349637edb.235.2021.07.15.12.24.54; Thu, 15 Jul 2021 12:25:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SqIcS1ks; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245506AbhGOTYI (ORCPT + 99 others); Thu, 15 Jul 2021 15:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:45622 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242437AbhGOTHZ (ORCPT ); Thu, 15 Jul 2021 15:07:25 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id EEBC761403; Thu, 15 Jul 2021 19:03:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626375799; bh=fb8gOiQrEf7WMMt9bnuvLr3twVkQHK/nTUyeq/tbNNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SqIcS1ks2zMiEZixanyiic62fF4OZ12V7CJlu4CslPBaQ+eYRtT4sM77DSLdb029L Y/7gX7uNhFWMNMSqBI1fNC6wRqnv4Dv8IJUxQsNYVUq4MVP4FYXMWzqrL4Dm/mHajs 8dC/V5YPxzaae6xhrwVQCfxBZiUypgZyxw7LFeG8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot , Tetsuo Handa , Casey Schaufler Subject: [PATCH 5.12 240/242] smackfs: restrict bytes count in smk_set_cipso() Date: Thu, 15 Jul 2021 20:40:02 +0200 Message-Id: <20210715182635.102657808@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210715182551.731989182@linuxfoundation.org> References: <20210715182551.731989182@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tetsuo Handa commit 49ec114a6e62d8d320037ce71c1aaf9650b3cafd upstream. Oops, I failed to update subject line. >From 07571157c91b98ce1a4aa70967531e64b78e8346 Mon Sep 17 00:00:00 2001 From: Tetsuo Handa Date: Mon, 12 Apr 2021 22:25:06 +0900 Subject: [PATCH 5.12 240/242] smackfs: restrict bytes count in smk_set_cipso() Commit 7ef4c19d245f3dc2 ("smackfs: restrict bytes count in smackfs write functions") missed that count > SMK_CIPSOMAX check applies to only format == SMK_FIXED24_FMT case. Reported-by: syzbot Signed-off-by: Tetsuo Handa Signed-off-by: Casey Schaufler Signed-off-by: Greg Kroah-Hartman --- security/smack/smackfs.c | 2 ++ 1 file changed, 2 insertions(+) --- a/security/smack/smackfs.c +++ b/security/smack/smackfs.c @@ -855,6 +855,8 @@ static ssize_t smk_set_cipso(struct file if (format == SMK_FIXED24_FMT && (count < SMK_CIPSOMIN || count > SMK_CIPSOMAX)) return -EINVAL; + if (count > PAGE_SIZE) + return -EINVAL; data = memdup_user_nul(buf, count); if (IS_ERR(data))