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 47A79C43381 for ; Fri, 22 Mar 2019 11:28:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1557821917 for ; Fri, 22 Mar 2019 11:28:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254134; bh=mLIyTHY7Iym1vABhmU8TzzzvGRa9z4JTeZglslXV9Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xAldzUuER+Qf78wqcYFMFe75ANbBPfu8sNWcEDEsxLzCLu/DrCKgIRuAnonsTCMq9 QbXvNyEShFar3n68qcl3CuCWw4Uzase76XXFr/wSbbBcTrRx8qEGpSA6Q9VnbgcMmv usbT353KSLXJf/gXWISDW+KP+zwEliB7scsoO7UA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729734AbfCVL2w (ORCPT ); Fri, 22 Mar 2019 07:28:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:56614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729720AbfCVL2s (ORCPT ); Fri, 22 Mar 2019 07:28:48 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 46AB121916; Fri, 22 Mar 2019 11:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553254127; bh=mLIyTHY7Iym1vABhmU8TzzzvGRa9z4JTeZglslXV9Qs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WfB5Be/hFaJFBAaxfcstBiEPmFOLb346hksVvCiLzMBCxu0Gi3PENJv5kISHxvwPZ s8oHnRaPUAGE6CNBwIsp5KrqCDR+B44010muRUs1f1YCcp3AJP4p1yV/qKSPEvtz24 yX0qkYEEqFcNm6VxKA9er+41jlIPGxbL/fzexjIU= 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.4 024/230] net/packet: fix 4gb buffer limit due to overflow check Date: Fri, 22 Mar 2019 12:12:42 +0100 Message-Id: <20190322111238.413706193@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111236.796964179@linuxfoundation.org> References: <20190322111236.796964179@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.4-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 @@ -4217,7 +4217,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))