-----Original Message----- From: Jakub Kicinski kuba@kernel.org Sent: Tuesday, July 22, 2025 2:53 AM To: Chia-Yu Chang (Nokia) chia-yu.chang@nokia-bell-labs.com Cc: alok.a.tiwari@oracle.com; pctammela@mojatatu.com; horms@kernel.org; donald.hunter@gmail.com; xandfury@gmail.com; netdev@vger.kernel.org; dave.taht@gmail.com; pabeni@redhat.com; jhs@mojatatu.com; stephen@networkplumber.org; xiyou.wangcong@gmail.com; jiri@resnulli.us; davem@davemloft.net; edumazet@google.com; andrew+netdev@lunn.ch; ast@fiberby.net; liuhangbin@gmail.com; shuah@kernel.org; linux-kselftest@vger.kernel.org; ij@kernel.org; ncardwell@google.com; Koen De Schepper (Nokia) koen.de_schepper@nokia-bell-labs.com; g.white@cablelabs.com; ingemar.s.johansson@ericsson.com; mirja.kuehlewind@ericsson.com; cheshire@apple.com; rs.ietf@gmx.at; Jason_Livingood@comcast.com; vidhi_goel@apple.com Subject: Re: [PATCH v25 net-next 1/6] sched: Struct definition and parsing of dualpi2 qdisc
CAUTION: This is an external email. Please be very careful when clicking links or opening attachments. See the URL nok.it/ext for additional information.
On Sat, 19 Jul 2025 22:41:24 +0200 chia-yu.chang@nokia-bell-labs.com wrote:
q = qdisc_priv(sch);
sch_tree_lock(sch);
if (tb[TCA_DUALPI2_STEP_THRESH_PKTS] && tb[TCA_DUALPI2_STEP_THRESH_US]) {
NL_SET_ERR_MSG_MOD(extack, "multiple step thresh attributes");
sch_tree_unlock(sch);
return -EINVAL;
}
tb[] is local state on the stack, parsed from the netlink message (also local). You can move the:
q = qdisc_priv(sch); sch_tree_lock(sch);
lines after the check and then you won't have to unlock on the error path.
Thanks! I've fixed in the recent v26. And the check of both step thresholds is done like below, so no unlock is needed.
err = nla_parse_nested(tb, TCA_DUALPI2_MAX, opt, dualpi2_policy, extack); if (err < 0) return err; if (tb[TCA_DUALPI2_STEP_THRESH_PKTS] && tb[TCA_DUALPI2_STEP_THRESH_US]) { NL_SET_ERR_MSG_MOD(extack, "multiple step thresh attributes"); return -EINVAL; }
q = qdisc_priv(sch); sch_tree_lock(sch);