Received: by 2002:ac0:b08d:0:0:0:0:0 with SMTP id l13csp4940871imc; Mon, 25 Feb 2019 14:05:11 -0800 (PST) X-Google-Smtp-Source: AHgI3IYeqpy7LEAGmG3KpVpVwxRu6D2Y67hTn12hHggqq9X4b+MIJuUHABs7iPKmJwPYJIj8EltD X-Received: by 2002:a17:902:728d:: with SMTP id d13mr9034623pll.12.1551132311212; Mon, 25 Feb 2019 14:05:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551132311; cv=none; d=google.com; s=arc-20160816; b=Gmq4CeJaZZyD8SqjFvITZl4c+kjipvITYAETjIVVAXNF6sVAs/KzsxyyxSj+Lojqsv JCJc00MT447zLac49iiwCbFOZrAdbBiqbd1n6PPMbyKtp87P1p9HIpY05r4F4BV0xkH3 spVtv9GMaDnyMcEI9ntMlTKflpmcJuJSvzfRqmHIfBa0jTbuxqOu0P33oTgUJRDHQL2U VZEc+sePgWWsVl3gIoEvLKaV9Jm7nYEznbJE0rl/0najY6979UT1itNVNfAgGkvd7TEw pwAs9I2NoM82bpwj/8vnaCae1sVRIQKZc22bAja6ZZeYHP1LpXLTZg7PMGrzLy5K/7p+ iG3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6rsRDufny6226eLOAHENKo9kLg/K+AdbfvABHZxmoBo=; b=DO+E3q62GWUvIj4WjxQzfCoMnQxiHBVdwjJVWjbsjzQa/uWJ5Dt5xn5B7++sgX8vep zqD7vQTF40trqVJqCa3aI1oc3wZ9woHgSDDXtKkYxJzl7qWlLkjW51MDEVFbcmITRo7h Hu62kxpkeWHrYlIb4V9SYN+f9QAmjuxrLW4PJEqxZLF9xCWwAQ2Ed0RZhSpx7oOLbsls 7ce5OQJi/AXaCwpiJu7KZAZ1TZPpKeEmLmeYuKY1czRs0uBA4AsAMiQzqiSYMirkyxqF wOncS/oK0PFI2+xIUmHZw66hO0yRyqJZ6U9gbsgyQYEr/pMUpYo6noZyGJB5lsl+nDxH f7LA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ni61VmNS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j2si6053569pfb.268.2019.02.25.14.04.55; Mon, 25 Feb 2019 14:05:11 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ni61VmNS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729160AbfBYVOJ (ORCPT + 99 others); Mon, 25 Feb 2019 16:14:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:44916 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729151AbfBYVOG (ORCPT ); Mon, 25 Feb 2019 16:14:06 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D4B492146F; Mon, 25 Feb 2019 21:14:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551129246; bh=Qu6YXJD6UIdwP4te3YzhXYblvnfuFnM+RFGEI1hhFoA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ni61VmNSfQMowReZiQpM7lr7xm5mBVM3VQd4IObvT+osflJBMN6nRxGw9d7gnQKhM disJOVmiWEa6NdYTJ/ZBcVR/y39nxDuMz7g8YpvUwydBSEF4SSUDWtojqOjUjiFTMC nw4gGyeRjE/ETPlCV7/GVSPshiZZ4s3qsZEMns40= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kal Conley , "David S. Miller" Subject: [PATCH 4.9 33/63] net/packet: fix 4gb buffer limit due to overflow check Date: Mon, 25 Feb 2019 22:11:33 +0100 Message-Id: <20190225195038.354634062@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225195035.713274200@linuxfoundation.org> References: <20190225195035.713274200@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Kal Conley [ Upstream commit fc62814d690cf62189854464f4bd07457d5e9e50 ] When calculating rb->frames_per_block * req->tp_block_nr the result can overflow. Check it for overflow without limiting the total buffer size to UINT_MAX. This change fixes support for packet ring buffers >= UINT_MAX. Fixes: 8f8d28e4d6d8 ("net/packet: fix overflow in check for tp_frame_nr") Signed-off-by: Kal Conley Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c @@ -4316,7 +4316,7 @@ static int packet_set_ring(struct sock * rb->frames_per_block = req->tp_block_size / req->tp_frame_size; if (unlikely(rb->frames_per_block == 0)) goto out; - if (unlikely(req->tp_block_size > UINT_MAX / req->tp_block_nr)) + if (unlikely(rb->frames_per_block > UINT_MAX / req->tp_block_nr)) goto out; if (unlikely((rb->frames_per_block * req->tp_block_nr) != req->tp_frame_nr))