Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2874970pxu; Sat, 19 Dec 2020 05:02:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeROWzWDbiZOhT7MeJlwf7+WgKqGEWL42BXdJdxyuW2aaKMP0SLIpWM+bvGKBvVgwNzn93 X-Received: by 2002:a50:b746:: with SMTP id g64mr8738613ede.33.1608382925913; Sat, 19 Dec 2020 05:02:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608382925; cv=none; d=google.com; s=arc-20160816; b=Y0zLkiZezddUHVVs4P5Z/7arxkMFbjxQGYXM5qDnWSAOX8UHcSe23/4oHpi1t1BJNs jaWiFqE0YxiJ/09WogDdbQALSUVCFluy2JfBIn4X1ZHx9h+PX5nyiNnpfaLNYeZMZ2hK WT4Xv0OboZnBWYuaX/iNzRFc3gM8bXvoovFg9WvAL/ZcI3c9AoEUXh/uMALBCosGyR/m 35KbzUoO/1CGXaTXCUWFiEOEcWxycknst+OenIIXGCcSqgWlQ3diIvQXLYQsx3aOGhkY APwrMp3U1lCpdNUTD6vVFREcb5d82uqMHmQDgQuofkdi8A6ydXPAOR1BZR87yUzN2VjJ kGsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=jxVbDIyb5ejscplp3txkugsiXCqCOPi+JBZNzQ5X/Vw=; b=HSiZUTG4dtjTuZMJq0Z705s0tJQCMMbfvnzSiozf25Xg499IY2JMmJ5IC6dth27oK3 ZRmAnPFAoEUxWBCViha8GPlf+LMymkAP/ggNbiHw290ZijV/XyNCXc7phlniY0VWRC5g Yum4eq9EYJ43qPkAT/jnug1xbvfjr5F/pJKGDjcsZwOJQwy8Q6zW3edxOg4AzilhUTWg c67vJl2WNGl/+7/2+eAMSxWxxnuEeTc60t4/8C8M+1ECACxqZVeg+ph9xTh0aonnx7IX WxqC5JKcTnIzgI7OXep/GztTDr5lcfrQLK8uOvzklm/nhqBeCe8btos8try2+aFbgv/a HuxQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m19si7842240edb.315.2020.12.19.05.01.42; Sat, 19 Dec 2020 05:02:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727892AbgLSM6x (ORCPT + 99 others); Sat, 19 Dec 2020 07:58:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:45390 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727291AbgLSM6o (ORCPT ); Sat, 19 Dec 2020 07:58:44 -0500 From: Greg Kroah-Hartman Authentication-Results: mail.kernel.org; dkim=permerror (bad message/signature format) To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Davide Caratti , Cong Wang , Jakub Kicinski Subject: [PATCH 5.9 02/49] net/sched: fq_pie: initialize timer earlier in fq_pie_init() Date: Sat, 19 Dec 2020 13:58:06 +0100 Message-Id: <20201219125344.789306610@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201219125344.671832095@linuxfoundation.org> References: <20201219125344.671832095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Davide Caratti [ Upstream commit 4eef8b1f36f2ff06966b8f7c2143ef0c447877de ] with the following tdc testcase: 83be: (qdisc, fq_pie) Create FQ-PIE with invalid number of flows as fq_pie_init() fails, fq_pie_destroy() is called to clean up. Since the timer is not yet initialized, it's possible to observe a splat like this: INFO: trying to register non-static key. the code is fine but needs lockdep annotation. turning off the locking correctness validator. CPU: 0 PID: 975 Comm: tc Not tainted 5.10.0-rc4+ #298 Hardware name: Red Hat KVM, BIOS 1.11.1-4.module+el8.1.0+4066+0f1aadab 04/01/2014 Call Trace: dump_stack+0x99/0xcb register_lock_class+0x12dd/0x1750 __lock_acquire+0xfe/0x3970 lock_acquire+0x1c8/0x7f0 del_timer_sync+0x49/0xd0 fq_pie_destroy+0x3f/0x80 [sch_fq_pie] qdisc_create+0x916/0x1160 tc_modify_qdisc+0x3c4/0x1630 rtnetlink_rcv_msg+0x346/0x8e0 netlink_unicast+0x439/0x630 netlink_sendmsg+0x719/0xbf0 sock_sendmsg+0xe2/0x110 ____sys_sendmsg+0x5ba/0x890 ___sys_sendmsg+0xe9/0x160 __sys_sendmsg+0xd3/0x170 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 [...] ODEBUG: assert_init not available (active state 0) object type: timer_list hint: 0x0 WARNING: CPU: 0 PID: 975 at lib/debugobjects.c:508 debug_print_object+0x162/0x210 [...] Call Trace: debug_object_assert_init+0x268/0x380 try_to_del_timer_sync+0x6a/0x100 del_timer_sync+0x9e/0xd0 fq_pie_destroy+0x3f/0x80 [sch_fq_pie] qdisc_create+0x916/0x1160 tc_modify_qdisc+0x3c4/0x1630 rtnetlink_rcv_msg+0x346/0x8e0 netlink_rcv_skb+0x120/0x380 netlink_unicast+0x439/0x630 netlink_sendmsg+0x719/0xbf0 sock_sendmsg+0xe2/0x110 ____sys_sendmsg+0x5ba/0x890 ___sys_sendmsg+0xe9/0x160 __sys_sendmsg+0xd3/0x170 do_syscall_64+0x33/0x40 entry_SYSCALL_64_after_hwframe+0x44/0xa9 fix it moving timer_setup() before any failure, like it was done on 'red' with former commit 608b4adab178 ("net_sched: initialize timer earlier in red_init()"). Fixes: ec97ecf1ebe4 ("net: sched: add Flow Queue PIE packet scheduler") Signed-off-by: Davide Caratti Reviewed-by: Cong Wang Link: https://lore.kernel.org/r/2e78e01c504c633ebdff18d041833cf2e079a3a4.1607020450.git.dcaratti@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/sched/sch_fq_pie.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/net/sched/sch_fq_pie.c +++ b/net/sched/sch_fq_pie.c @@ -401,6 +401,7 @@ static int fq_pie_init(struct Qdisc *sch INIT_LIST_HEAD(&q->new_flows); INIT_LIST_HEAD(&q->old_flows); + timer_setup(&q->adapt_timer, fq_pie_timer, 0); if (opt) { err = fq_pie_change(sch, opt, extack); @@ -426,7 +427,6 @@ static int fq_pie_init(struct Qdisc *sch pie_vars_init(&flow->vars); } - timer_setup(&q->adapt_timer, fq_pie_timer, 0); mod_timer(&q->adapt_timer, jiffies + HZ / 2); return 0;