From patchwork Tue Aug 6 22:45:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 170684 Delivered-To: patch@linaro.org Received: by 2002:ac9:2daa:0:0:0:0:0 with SMTP id g42csp6003459oce; Tue, 6 Aug 2019 15:45:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkhKIVallh+A0nfRJkGft0753UDf+MSSSTkDKrIfaJi+ydIg5aSmZCGLVpZxwmFmV32mM4 X-Received: by 2002:a17:90a:d14a:: with SMTP id t10mr5467176pjw.85.1565131547659; Tue, 06 Aug 2019 15:45:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565131547; cv=none; d=google.com; s=arc-20160816; b=njUQMp4HEMqI/kyr7XeUkIBE+wwpphh8aIA9tNMimQLIni6iEP4mSF0zQ+V/H6LROb 1O46+4KgFhZpYtI07Np13Av5LXImQcrBwwYCFVGWGhkctq0HIR3MsSPdhetpDN+/VNAj swR1RqP55Z5h87UhpXnFf29hxiIDDlemReJuva0R8WFUBgE0INIYhAg9j1nmoYUrRbGX jvi5Kr51wDG+sXFRNh+fuoH7ADQ+lPGQxr3PV+C2fyeUrqzmomhw8HzU51B2Fdj01mOl ZeIELfjuyy6D5cGPjmmEKcM1ZxbSqbO0xHF/f4o4O9zPZuSSvnZzBb4WiaqEzNilsfR/ pjmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=yFlcIGmAU2Q+uytclp71VZt3u5YOqHJodYGg72mUCzc=; b=IpVPuvAFzDnaQ0ZH9yChows3wQ9V3Q1tfzxHIAPu8EO54lD9ERk3rH79sE3hASQ+pT Y8RHaQi3hXuHANUWek1Q36Wi4bhlCq9cr7n1OZOoVoRQrXn2PzrFOPmIze7T4CuyK9Ag jpo+8E52Bq5owamDZbDdSbf4oQiJc2W+H6WXMn1lxfZWkaVM+90Gp1RSJHUwxIFrV5zf qQs11rKAh/6BPAt0TljT+ICU1d+Gnviz3qKg38cLVPpkDf61bsfvMD0GdkW7Ok/g3m4U 7rpNBq/gjJZBuy+w6dNp+aa6Qi/E6UQhs0mGWMH2fWBCPdakN4wEikhaNcxZkjnww075 NSEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="GbTjz/2s"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p125si47189694pfp.35.2019.08.06.15.45.47; Tue, 06 Aug 2019 15:45:47 -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=@linaro.org header.s=google header.b="GbTjz/2s"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727077AbfHFWpq (ORCPT + 28 others); Tue, 6 Aug 2019 18:45:46 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:35785 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726069AbfHFWpp (ORCPT ); Tue, 6 Aug 2019 18:45:45 -0400 Received: by mail-lj1-f193.google.com with SMTP id x25so83691828ljh.2 for ; Tue, 06 Aug 2019 15:45:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=yFlcIGmAU2Q+uytclp71VZt3u5YOqHJodYGg72mUCzc=; b=GbTjz/2s4NjsyNf0XtwpIGx2XV/fhtcfMSKIKlRJXkD9uQ5mQ9ip7LHSp5MrQDSHT2 9H/vZ9roGFqPllWoYovJJRa2aOtFjhsPn9Iw0pWUW1ZMVPfk9U//Ju8G/l9ovKsbufzw q2wrMMGsHQ2w/MUQavcj7lKXuvcx6eitC4HKg3t7C7rlYZzovmqS49rkgQ/esrqfnDVw eezHif8/em/bku2sgVbKe1P/SCNc7B0DBllLUk87nFP6btrR4iLrw8zILBq4PP0IJrY3 LT3JoHgVDe597SQVwij/Fx9Mu4spKfE9Qcfen+HJUIyptPt55p48MZm3sA5kvjY5UYGY hK0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=yFlcIGmAU2Q+uytclp71VZt3u5YOqHJodYGg72mUCzc=; b=R2gfEozw2LZW+RNYwRUuBEaocdl4XIbDe/YDCglDZpbzCNqgnDj3FymMZ18dxRkAOP t/sYXZO0Qf40Ve8byhMbI2lsTcrxP+34Zd8vbDChY4M1mKU3agtzHQxQ9oY+62WgyLJ1 zXbVXIHxAc+Z66ApZMSLD6T0kFuyHVh54R2gZv2hSXcdhYmMCJTHBNxIoq4ERIqT2hJR PBgs9XUuIcym4+lcVp9C/15MuLIJSF60ZIo7yfJvClCzFr8P9bK84E7ugF7V3F/LL1/3 7P0tGQ5W5S92PHnFevFkoyCBWRgQbPMZJTY7t2wDx0Ee0TVwiLUKPWuRO2AyO5tTWZVb nh+Q== X-Gm-Message-State: APjAAAWs8PTwVhnMIe3Md+CbcXoxy6zTVThJvxd5r50WJIa7vkJ5sMOx nz/6AR0mUFEVnHNj7XK7LTkHNQ== X-Received: by 2002:a2e:96d5:: with SMTP id d21mr3024100ljj.170.1565131543482; Tue, 06 Aug 2019 15:45:43 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id j30sm2540507lfk.48.2019.08.06.15.45.42 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 15:45:42 -0700 (PDT) From: Ivan Khoronzhuk To: vinicius.gomes@intel.com, davem@davemloft.net Cc: jhs@mojatatu.com, xiyou.wangcong@gmail.com, jiri@resnulli.us, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, Ivan Khoronzhuk Subject: [PATCH v2] net: sched: sch_taprio: fix memleak in error path for sched list parse Date: Wed, 7 Aug 2019 01:45:40 +0300 Message-Id: <20190806224540.24912-1-ivan.khoronzhuk@linaro.org> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In error case, all entries should be freed from the sched list before deleting it. For simplicity use rcu way. Fixes: 5a781ccbd19e46 ("tc: Add support for configuring the taprio scheduler") Acked-by: Vinicius Costa Gomes Signed-off-by: Ivan Khoronzhuk --- net/sched/sch_taprio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.17.1 diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index c39db507ba3f..e25d414ae12f 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1195,7 +1195,8 @@ static int taprio_change(struct Qdisc *sch, struct nlattr *opt, spin_unlock_bh(qdisc_lock(sch)); free_sched: - kfree(new_admin); + if (new_admin) + call_rcu(&new_admin->rcu, taprio_free_sched_cb); return err; }