From patchwork Tue Aug 6 10:04:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Khoronzhuk X-Patchwork-Id: 170655 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp5475312ile; Tue, 6 Aug 2019 03:04:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrSohmD2yIJObbbUYNprS6xdHqICuo3k2EKPE5Z376KHvuv8SvCfWWWYU0Hf4jHjzSs+ym X-Received: by 2002:a17:90a:7f85:: with SMTP id m5mr2363446pjl.78.1565085882079; Tue, 06 Aug 2019 03:04:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565085882; cv=none; d=google.com; s=arc-20160816; b=FdhlKzeWLBKsG6RqP6BFC9fGzcFXrWUypbpm1ofFmMfVP921oxkRT8pVmoR7IdWRBa ri7qGngsZF/Q0ElpwmsNBtu24wryM8O+1hhTM1ivy/WAptFprZVx3eIzX5YmU3yqXuXi 7AJDpvUqcudeuxCqmLJ61FgRd1U/5OpZPfL9twVv4tlScetuEQpakWjo5nc+nWxipK3Q SQCY+++HpEhvY+ldWQFkpmtXzGHVUrCgDlz7cedxOq8pHcoWx0IGZXslpoYuCVdoRTh9 tG9sucFK6dyTPp4lNW7sMjnJVciU25iOIrM2qyrwLOid8nQH2yC/CW8kmnQfu3qNo7FR X2ew== 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=NXZqY3+lqrfveECnrnsKCEH+PDiQa8H/JttSLewgIGaSQUrMlf+zXsUuWv3a6BwFdY 7JX2u/LNaAd++DVCmryG5H949wvHPew8DCIcBhx2BjrTnPJHj1jHkQ4JDSW08wXg6Tvq Z+5iO4g8bZLneDo8tgcf1N4WxLk08dfQl373kQ/VvaQtaSc7kli/22xIiBRHObArgA7s iduFP2Spip5HHs9vSWtt97Gw6+5kahv3ZZNDmBmtiYJKBBjhU90RXozZz5SA0AEnoV9J dA0QJqRAyYovahRgaLJyyB/beKlfLKB5gtiirixQTg4IhMAS2OgHbD5AdEjZ5Dc5fTwV LpLQ== 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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 j18si47691310pfe.235.2019.08.06.03.04.41; Tue, 06 Aug 2019 03:04:42 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 S1732662AbfHFKEk (ORCPT + 8 others); Tue, 6 Aug 2019 06:04:40 -0400 Received: from mail-lf1-f67.google.com ([209.85.167.67]:40039 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732411AbfHFKEi (ORCPT ); Tue, 6 Aug 2019 06:04:38 -0400 Received: by mail-lf1-f67.google.com with SMTP id b17so60599449lff.7 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=hBQ5o9+/W7PCC51BWK3zghExpXl0s6mOU84upy65Sb1Ce4f67WDK1fGzhYxe2yt54d 5uYpjPDvqsDiJ9N4yu10BtkwVWptBPDnJp88cXhAvnqahDAj3V4aT/0ZNqesdS17xgcs ERZSLE4ITCKyWgylz3lqd2y6MRdcKbXNMAsts94wmWAmKVEA5CxWhnjoEXD0CuwoF6sw tCI7BOv9Bz/zuQEGXDMyTnnVKNP/0mWc9ceep//vX6R8FxFhLLv5ip3w4JzF513D7AeJ TzxJEe8BNfuI7js7mpqV1EkWovXrlBmIcsgTfSH/O8HHvxsEC8bLKyZLZxqdKloPIGmQ gBVQ== X-Gm-Message-State: APjAAAWXpjrxzZ0cl7xkIxr/Mb/Z0r/L0zaHQDliDU++neegZgKTdCsc P7GcLuF9VJtnsXSBn1HrDtiqYg== 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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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(-) -- 2.17.1 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; }