Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3050207ybi; Tue, 2 Jul 2019 01:09:00 -0700 (PDT) X-Google-Smtp-Source: APXvYqx7iSZLfp7W6xOST94/sGGheu5NfohwXYxt21NiK+qlyuNHT82X3TdnlKK+dwTieaVoGSGe X-Received: by 2002:a63:480a:: with SMTP id v10mr29446646pga.60.1562054939959; Tue, 02 Jul 2019 01:08:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562054939; cv=none; d=google.com; s=arc-20160816; b=I6qlFGRlJ43RUxsjjVPRJ1ZCtJPUq/M59AQdXkQp1/AZMBVhrDLR8oojxaNY20wfL8 +3cb0m/s2FGaNlSprTzdnuMcMVwUsusjNkXoYd9uMd188oXq9eMxNvrUpMDfw1KECvyF 7fIZSA+C05vyPoyNqouOITtQ4axXEJFN1T+iiHarA4kq9gyALIVVbNr3/+IOC2W5VkXu AM5MCYfT/C/7yUeVDAjFReurd0bMXCa1r43wiHkvRg0iIA91vSTfR1G8iAMkWENLChx6 NnLbrf3StMXCgyeDsxuxucA89aXnUIaIRn6hxbVFJ0pUiMKHs5bk4w20SlDt/cKhdU0D KSbw== 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=4049MJzbz2UF3eMluEbclvv4sRRipRfgVlLabq4NSOY=; b=pEkVsFYUpYoe21SPewqzuxC/GLG8j41Uu7HTiKWEkRL5x7NwjlEsNa4Z2bu+FL+0Mh GuiRajumaIND17Z6sabETsjxMiY/NhBfEW9hiBm4RsoVR/2wjiQlQUktK//4fIPEQyPE plLTefEUABsogmNGUmK4pvg0oTZl5LN6XWrxRMNxL8/qfKqmVkCDu390R39GeDFoWbGl 8PX42U4FpsorOU4/l66wyGCm7fIVvOazZhHwYw0Pgsu5aVPXHtyqCCBdiKY7qsZzuY/o frlHkj2jCdttxu6NtsZ6xPmTGVYoZKfQAXJ37CtDCpa2rp9NCakgyvROLokj8QEWspAf m/TA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LrZ3vjSb; 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 t14si12337136pgc.90.2019.07.02.01.08.44; Tue, 02 Jul 2019 01:08:59 -0700 (PDT) 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=LrZ3vjSb; 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 S1728276AbfGBIHc (ORCPT + 99 others); Tue, 2 Jul 2019 04:07:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:54768 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727724AbfGBIHa (ORCPT ); Tue, 2 Jul 2019 04:07:30 -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 F1947206A2; Tue, 2 Jul 2019 08:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054850; bh=gx5vd93f8/k8hXxgW9ILkcK+6s7352CHCW6PXJg7i+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LrZ3vjSbopsbIdxE0/iziCe7UA9xZBdi7uaaaldCqTKwQP2xQ+jq5dRep1tQcS4ri S+7iHG0q36Ns5+WQtywvJqQswJYAFbd4Gtl5UMW4t1XEMewgSbh7TRAm+R8g/fQgXu d3QnDHzfur+zHylSjR7y0buf+nGBrS8mEY1I/v6g= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Sowmini Varadhan , syzbot , "David S. Miller" Subject: [PATCH 4.19 53/72] net/packet: fix memory leak in packet_set_ring() Date: Tue, 2 Jul 2019 10:01:54 +0200 Message-Id: <20190702080127.333607089@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080124.564652899@linuxfoundation.org> References: <20190702080124.564652899@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Eric Dumazet [ Upstream commit 55655e3d1197fff16a7a05088fb0e5eba50eac55 ] syzbot found we can leak memory in packet_set_ring(), if user application provides buggy parameters. Fixes: 7f953ab2ba46 ("af_packet: TX_RING support for TPACKET_V3") Signed-off-by: Eric Dumazet Cc: Sowmini Varadhan Reported-by: syzbot Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- net/packet/af_packet.c | 3 ++- 1 file changed, 2 insertions(+), 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 * req3->tp_sizeof_priv || req3->tp_feature_req_word) { err = -EINVAL; - goto out; + goto out_free_pg_vec; } } break; @@ -4380,6 +4380,7 @@ static int packet_set_ring(struct sock * prb_shutdown_retire_blk_timer(po, rb_queue); } +out_free_pg_vec: if (pg_vec) free_pg_vec(pg_vec, order, req->tp_block_nr); out: