Received: by 2002:a25:b794:0:0:0:0:0 with SMTP id n20csp3892104ybh; Tue, 6 Aug 2019 03:07:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqyq72/H3AuBTmSNlsvrFNt+cVgCo18OLAKgY7ude3EiPwHl4Xx9UDMSth2tptntkSEoc0cY X-Received: by 2002:a63:ff0c:: with SMTP id k12mr2241303pgi.186.1565086034453; Tue, 06 Aug 2019 03:07:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565086034; cv=none; d=google.com; s=arc-20160816; b=tABuQR+3Q9R2n7slykEkBKVw8Zt97Ev6cI9wMvlD3JNSLWk4Myg+3ONxYF3mnFmR6L H14lyYUDvJ+KUaftf2OqRKhjQFlqCwVEchUkX52TYwb9VhsOHRwjNgVEreUxOoYB3kTS gMRy3S0wysaqkPmZLL7DZlQ8sa7MtCEJl+lAv1bet0Kcdr8Wb7bouU3va1IVJkHLKw1d 6Cmwj4GyEJMjlVzXlhaxxpvzXNuOkZu/RFvctMPD2MjqIr0pSgD51RKOA2wuF1i8METB zcpyCrcJhMQfxDvaommumPR7/GmNOHAK99IYjRZap1Vpjl1ohOHZCz+tJlg8LvWKwFzh ZlmA== 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=5TEpMf9ydlfbXzNe485u5gwcmlpP2W7mB7vtw4xNQQ4=; b=ZVg4Oulixa3iv4e8PtjRXh1JOZnmHECx/w/5bQh43454pfmbmsBfZzVeZIZQoswKsz kn9pT4ArP8PTFzIy12VopHq/+qJ3Bb0fR0svbxMJ7p5ncnhF0AJmoN2mO4l1WPxSBIxb xa8Jb1MK4LQf1qsqsbd/MXuI1R8tHeFWuS3C2Fqrjnz8JM4pnpAECUPLJpzm+cQMIywh qRuJauWGbNF18T0AYeb577eQg5h6ep97tXkLXrti/tq4Mo1UB288rycuHikkM2/qiJ5f huYO8fjVjQVCW9oY2nMummiOfYt559rJ4P1zy6M1HO4L39LxgZTPciX3IZWb/j6L68b9 sXyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=k1k+QDSC; 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 k73si15881590pje.10.2019.08.06.03.06.58; Tue, 06 Aug 2019 03:07:14 -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=k1k+QDSC; 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 S1732611AbfHFKEi (ORCPT + 99 others); Tue, 6 Aug 2019 06:04:38 -0400 Received: from mail-lf1-f65.google.com ([209.85.167.65]:42999 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732472AbfHFKEi (ORCPT ); Tue, 6 Aug 2019 06:04:38 -0400 Received: by mail-lf1-f65.google.com with SMTP id s19so60590769lfb.9 for ; Tue, 06 Aug 2019 03:04:37 -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=5TEpMf9ydlfbXzNe485u5gwcmlpP2W7mB7vtw4xNQQ4=; b=k1k+QDSCc7OEAmnqo1P0gvMHj8zkLFalVRTHvMQKj0URb9HudpNuUObP9zjBvKqYUX bCp2hwTwOlfE0p0ddM+hJrCFL9oiky6xK0F7+cu1S3XiXKkiUpT6OWLR1FVZXBljQXIy K7dYo96ycFB5ghJ+yjERH8T/bCn0mmhCluh150MJMR40LU/0AZb1Ni0cLceGbsvLpu0X AqCDRS5n3bsL7Xviv/rAKvczZSFv5As+y06g6NlZr4obtGbu9vu8ERq32VFhaMSmcEKZ +YQ9dmlQMJRhsikM9tdkn1LTjfjeMuPvr9UcTyHR/xKGLnyeFCBsfgf5hrS+aYg0qAEm rizA== 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=5TEpMf9ydlfbXzNe485u5gwcmlpP2W7mB7vtw4xNQQ4=; b=s8PSF5fgQ9VAPC0BClcv1Vrfoh6/JO0vN+2yHgsDOL+aH4KpSu1Z6nopojgWWAf2KJ 5DE3fAaH7NCLjgClh/UZNtnYnyT5SLf8FKsl1M1Vd0XvtFdeuYJ7eZhO38z+UadELPZC dghaZeHgKUMD49aZ149+HMKM4f1Le887s4023hFiomhldihEbUCwYNwloWwoUw8zr5lk 8dori7fqXBysdG4dKFCXGf2LV29cGFBp+ewsJKpXsZyXgDpfXof4xilYvDbxcVIqSl9U EctxraKB1E02Ojrl2y1XZDWPgs3L75Zq5pxM/CFhEIgpSHPgMchG2PrHQC2XABiQwNZi 1fOg== X-Gm-Message-State: APjAAAWy5QqlX/AWNxkRgLDHRd9s4qpxYRpxt/POaVppUX6axT2gPZOa c67KeDmdyGInjYA54WDmRIluGQ== X-Received: by 2002:ac2:5492:: with SMTP id t18mr1889487lfk.41.1565085876500; Tue, 06 Aug 2019 03:04:36 -0700 (PDT) Received: from localhost.localdomain (59-201-94-178.pool.ukrtel.net. [178.94.201.59]) by smtp.gmail.com with ESMTPSA id p19sm1388903ljg.97.2019.08.06.03.04.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 06 Aug 2019 03:04:35 -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] net: sched: sch_taprio: fix memleak in error path for sched list parse Date: Tue, 6 Aug 2019 13:04:25 +0300 Message-Id: <20190806100425.4356-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 case off error, 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") Signed-off-by: Ivan Khoronzhuk --- Based on net/master net/sched/sch_taprio.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/net/sched/sch_taprio.c b/net/sched/sch_taprio.c index b55a82c1e1bc..4f6333035841 100644 --- a/net/sched/sch_taprio.c +++ b/net/sched/sch_taprio.c @@ -1451,7 +1451,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; } -- 2.17.1