From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A0FFAC43381 for ; Mon, 25 Feb 2019 22:00:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5E8A02146F for ; Mon, 25 Feb 2019 22:00:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551132021; bh=AutJrMoQJjNZKPVhUcTloAldMNjlrVS60Nqr1mgsa8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2N0xCsUSEBDJTl7Lm95ReFLJkC/vKz9uhPfzHVWN/owr19XyX4sAXf87JRG7w8T6j uc1JvURFUi01pCJxj9ldXbZ/Bs5atRhQ61fkevJb/gvxVw6o+NDhyUysYIbV/klJVw 1R8F15n7b1Ti2ijBb/1liFbsfZGEyQuXFaSpl4Z4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730057AbfBYWAU (ORCPT ); Mon, 25 Feb 2019 17:00:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:50634 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729596AbfBYVSJ (ORCPT ); Mon, 25 Feb 2019 16:18:09 -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 04A88217F4; Mon, 25 Feb 2019 21:18:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1551129489; bh=AutJrMoQJjNZKPVhUcTloAldMNjlrVS60Nqr1mgsa8g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJ83KqEJBND2EkdqaBv+ELtPlCQ1WaLG0rtXbIpmCmnotLn7fXfM5+8gfpuFKSewB 7TiiwqLgIf3QRS5HCuxmy0w+cbsQXz45cDr9IMP6RMcrpfMcbxgKwqoiMpaMhkVYPs Xx6rMWp2JHGeu0wrESFFMfzO2YSnl3Akw48y9F30= 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.14 48/71] net/packet: fix 4gb buffer limit due to overflow check Date: Mon, 25 Feb 2019 22:11:50 +0100 Message-Id: <20190225195038.250542141@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190225195034.555044862@linuxfoundation.org> References: <20190225195034.555044862@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.14-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 @@ -4313,7 +4313,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))