Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3054375ybi; Tue, 2 Jul 2019 01:14:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqxg8LtiO4Q+ZbXRaMwpXvLDgmvtFOiZK10PH2sD1KP3QBArBsEAOcY9TRoMm6qwEGif4XXp X-Received: by 2002:a65:4808:: with SMTP id h8mr6703604pgs.22.1562055247526; Tue, 02 Jul 2019 01:14:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562055247; cv=none; d=google.com; s=arc-20160816; b=bkHwqyUb5fkdVSN8ltzq0ZdPjPae5AzArW/WretuHmEUzI3ihqZ2VpU0pCM/mz59OD Zk5hyj3sxRDx5Lmv5tDJ7aYgOOHO3c9JZd8WFxzssfxfSKhVZ1Xmi+SiOetjhicVh4YU a4i5hAjx3nm3iWQkcdfY88yo0v03PxFtL8pKOHZv8wS1p2tjOcv8GypqqyLT48baBMV9 DZBKzzEW0PGN7PlW9Wv80AK575u/ql87gxKmwyObiiMTHXvJeOhoTiAjgTk9MzHWzj45 glj4EtCaxQS3/Z6wAtd62dmZu9H4PFrZCG1uolUOKJxStvWFoUc03ha6eYodtGjyXzfW d12g== 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=0kzyaTswapEnrR9NhVO7Qbj2gtyZUCZilDbucItrX28=; b=Pt5g/6yNxhgzuBZnqxodSS4RX6owmm0fbmn7mBHXpb+brmT/2CAYSG2c33iQSbdqA1 2MQ9J15e8q+gISJp444MBbMnMTopVR2/Ew2AlAcZ2Z1zmIQd8VVOB1cb15lZ2Kax4f2H KjBk5XlTRirivwMmoqiHALJbHiw+gMyAN1PFREGZs6RqeyCHqjxTQajUvW2erW1wqyY1 27h58arQck2qQDIejLpaM6cl6SRB5zG4yVQ0Wq09BV8h03AyUqID4e4q3oU12EXv0Ldt yz/I989d1AieNiTrxYXqxBud8ZuTYPRSwApzWDTbzYV12XQmsnn6gva0KjayOFHtCE6j r/qg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DRtgOtqT; 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 v38si12092066plg.277.2019.07.02.01.13.53; Tue, 02 Jul 2019 01:14:07 -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=DRtgOtqT; 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 S1728286AbfGBILy (ORCPT + 99 others); Tue, 2 Jul 2019 04:11:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:57738 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727542AbfGBIJp (ORCPT ); Tue, 2 Jul 2019 04:09:45 -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 C000A20665; Tue, 2 Jul 2019 08:09:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562054985; bh=xDodtIMsKPm6YhLyrC/CzznVosZQjbuw83e+gldJATs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DRtgOtqTN2RJhAg1Zcm4230P2nv+6AglZLjFzjLhoQZ6pCrhXjLTqS1198MCKAY1k 8SipTZt+Q0leU2mp4+k6ukWq5WMcJJtedJgZfQF6fXA+G40L5ymxetn9kwkhmbNz+g LGwKgFfRQ8rE0lZHF+gVzBflE6UOMosifd0ujknA= 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.14 29/43] net/packet: fix memory leak in packet_set_ring() Date: Tue, 2 Jul 2019 10:02:09 +0200 Message-Id: <20190702080125.364407469@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190702080123.904399496@linuxfoundation.org> References: <20190702080123.904399496@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 @@ -4354,7 +4354,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; @@ -4418,6 +4418,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: