Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp3807479pxb; Mon, 4 Oct 2021 10:01:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkyM234OyFibQjRQOb3fsA7jwUhlsmYfs6Ur5rDgceFtU5jlrV2LvoQSN4lZP9U7Nmpq7D X-Received: by 2002:a63:1a55:: with SMTP id a21mr11656921pgm.158.1633366916606; Mon, 04 Oct 2021 10:01:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633366916; cv=none; d=google.com; s=arc-20160816; b=VfwLFHs/JzLsXqi+FbWZAMnicq5Qzz5W4c22fNKU8F3o1/1s6P8FWvgtU7onvPgKs4 OehaKyaNmI87CmZd7vcIe508KuXvYJOACGHINJ3AuJiPW8HYIhOX+b5WbzxsxaukoDSL CocWZChmOAMObqExbN/DyqpAj9Qw5lUT5Ry5WFCBmzVuE+6+0JwVRuTwpqQjDKuctC9Q +yfv+6Rv/2WVkJ2KB9qirFc65uA8d4YiYarCammMdrqjoE29OCetshPvutp5mpT3sNY/ gSCj73AnrqrLNmcUen/SstQ+gvtH++cc8Mu7ti+Eemsc2vKUa2sjwJFQUQFA2zKtUqpr jqVQ== 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=pIMfnh6n4DM/IBCjw3BmZr5abzLWNXEZKw2SMYtQKtE=; b=PuD9lU4eOlBf2WTz/7p4yM44obRkGNDA/pBix457XBdCoPs31XamM1kiJ9Mvt9QJkz gFj4JEo81QqM9OldQXCCAlFY/KiC7ijYGFgoLJdRemqrYfHBYSPilW4RaVptV2MzBmA8 AAVgplCYYyGD4Kb+O0S9hiMGGDfULYoeWK9uW3YqpC+U8mV3ltTonXmGh5lT5pLjkKwo LoCclqWQnjwzzbwNbebYy+QnFcgcH/+6cx9uAu6EAnsiRlu8/HWE9soXw/vOIhyga4Lf IKgjO1pWzUl6cXws5LgENijE8hfg8IGdBx7qVqk0HGByKAJXJTu8su1gQOLkbWUfSaVO NwjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mrzV+dLV; 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 a37si17047224pgm.292.2021.10.04.10.01.42; Mon, 04 Oct 2021 10:01:56 -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=mrzV+dLV; 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 S238703AbhJDNoW (ORCPT + 99 others); Mon, 4 Oct 2021 09:44:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:53132 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238371AbhJDNmE (ORCPT ); Mon, 4 Oct 2021 09:42:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8201163254; Mon, 4 Oct 2021 13:19:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1633353564; bh=IIGZjhefDL82qZ4bGe8+W6XTlEx8AkPNfd8WgAwNPwk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mrzV+dLV1lazwndL/LuQWozKc28EtWtBgDYqX3jfz4olDv66amA2AYJoq/2qcO3bU A2iHQRgqBiMASsnsvVg3wQfVN96ehicUSmwnyYlyU7nDJvfx0iE8+XdNqkwX3tep2p OQe1SLag1HnE3gJV3E+4QOowiSMd4ROgBcO0k1tg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+cd43695a64bcd21b8596@syzkaller.appspotmail.com, Pablo Neira Ayuso Subject: [PATCH 5.14 171/172] netfilter: nf_tables: Fix oversized kvmalloc() calls Date: Mon, 4 Oct 2021 14:53:41 +0200 Message-Id: <20211004125050.500603281@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211004125044.945314266@linuxfoundation.org> References: <20211004125044.945314266@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: Pablo Neira Ayuso commit 45928afe94a094bcda9af858b96673d59bc4a0e9 upstream. The commit 7661809d493b ("mm: don't allow oversized kvmalloc() calls") limits the max allocatable memory via kvmalloc() to MAX_INT. Reported-by: syzbot+cd43695a64bcd21b8596@syzkaller.appspotmail.com Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_api.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -4336,7 +4336,7 @@ static int nf_tables_newset(struct sk_bu if (ops->privsize != NULL) size = ops->privsize(nla, &desc); alloc_size = sizeof(*set) + size + udlen; - if (alloc_size < size) + if (alloc_size < size || alloc_size > INT_MAX) return -ENOMEM; set = kvzalloc(alloc_size, GFP_KERNEL); if (!set)