diff mbox series

[net] net/sched: act_gate: Unlock ->tcfa_lock in tc_setup_flow_action()

Message ID 12f60e385584c52c22863701c0185e40ab08a7a7.1603207948.git.gnault@redhat.com (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series [net] net/sched: act_gate: Unlock ->tcfa_lock in tc_setup_flow_action() | expand

Commit Message

Guillaume Nault Oct. 20, 2020, 3:34 p.m. UTC
We need to jump to the "err_out_locked" label when
tcf_gate_get_entries() fails. Otherwise, tc_setup_flow_action() exits
with ->tcfa_lock still held.

Fixes: d29bdd69ecdd ("net: schedule: add action gate offloading")
Signed-off-by: Guillaume Nault <gnault@redhat.com>
---
 net/sched/cls_api.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Cong Wang Oct. 21, 2020, 12:37 a.m. UTC | #1
On Tue, Oct 20, 2020 at 8:34 AM Guillaume Nault <gnault@redhat.com> wrote:
>
> We need to jump to the "err_out_locked" label when
> tcf_gate_get_entries() fails. Otherwise, tc_setup_flow_action() exits
> with ->tcfa_lock still held.
>
> Fixes: d29bdd69ecdd ("net: schedule: add action gate offloading")
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Looks like the err_out label can be just removed after this patch?
If any compiler complains, you have to fix it in v2, otherwise can be in a
separate patch.

Other than this,

Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

Thanks!
Jakub Kicinski Oct. 21, 2020, 4:04 a.m. UTC | #2
On Tue, 20 Oct 2020 17:37:22 -0700 Cong Wang wrote:
> On Tue, Oct 20, 2020 at 8:34 AM Guillaume Nault <gnault@redhat.com> wrote:
> >
> > We need to jump to the "err_out_locked" label when
> > tcf_gate_get_entries() fails. Otherwise, tc_setup_flow_action() exits
> > with ->tcfa_lock still held.
> >
> > Fixes: d29bdd69ecdd ("net: schedule: add action gate offloading")
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>  
> 
> Looks like the err_out label can be just removed after this patch?
> If any compiler complains, you have to fix it in v2, otherwise can be in a
> separate patch.
> 
> Other than this,
> 
> Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied, thank you!
Guillaume Nault Oct. 21, 2020, 7:52 a.m. UTC | #3
On Tue, Oct 20, 2020 at 05:37:22PM -0700, Cong Wang wrote:
> On Tue, Oct 20, 2020 at 8:34 AM Guillaume Nault <gnault@redhat.com> wrote:
> >
> > We need to jump to the "err_out_locked" label when
> > tcf_gate_get_entries() fails. Otherwise, tc_setup_flow_action() exits
> > with ->tcfa_lock still held.
> >
> > Fixes: d29bdd69ecdd ("net: schedule: add action gate offloading")
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>
> 
> Looks like the err_out label can be just removed after this patch?

That'd require reworking the error path, as err_out is used there. I
don't feel that doing so would improve readability much.

> If any compiler complains, you have to fix it in v2, otherwise can be in a
> separate patch.
> 
> Other than this,
> 
> Acked-by: Cong Wang <xiyou.wangcong@gmail.com>

Thanks.
diff mbox series

Patch

diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 41a55c6cbeb8..faeabff283a2 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -3712,7 +3712,7 @@  int tc_setup_flow_action(struct flow_action *flow_action,
 			entry->gate.num_entries = tcf_gate_num_entries(act);
 			err = tcf_gate_get_entries(entry, act);
 			if (err)
-				goto err_out;
+				goto err_out_locked;
 		} else {
 			err = -EOPNOTSUPP;
 			goto err_out_locked;