File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -1325,6 +1325,10 @@ int register_ftrace_graph(struct fgraph_ops *gops)
1325
1325
int ret = 0 ;
1326
1326
int i = -1 ;
1327
1327
1328
+ if (WARN_ONCE (gops -> ops .flags & FTRACE_OPS_FL_GRAPH ,
1329
+ "function graph ops registered again" ))
1330
+ return - EBUSY ;
1331
+
1328
1332
guard (mutex )(& ftrace_lock );
1329
1333
1330
1334
if (!fgraph_stack_cachep ) {
@@ -1401,17 +1405,21 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
1401
1405
{
1402
1406
int command = 0 ;
1403
1407
1408
+ if (WARN_ONCE (!(gops -> ops .flags & FTRACE_OPS_FL_GRAPH ),
1409
+ "function graph ops unregistered without registering" ))
1410
+ return ;
1411
+
1404
1412
guard (mutex )(& ftrace_lock );
1405
1413
1406
1414
if (unlikely (!ftrace_graph_active ))
1407
- return ;
1415
+ goto out ;
1408
1416
1409
1417
if (unlikely (gops -> idx < 0 || gops -> idx >= FGRAPH_ARRAY_SIZE ||
1410
1418
fgraph_array [gops -> idx ] != gops ))
1411
- return ;
1419
+ goto out ;
1412
1420
1413
1421
if (fgraph_lru_release_index (gops -> idx ) < 0 )
1414
- return ;
1422
+ goto out ;
1415
1423
1416
1424
fgraph_array [gops -> idx ] = & fgraph_stub ;
1417
1425
@@ -1434,4 +1442,6 @@ void unregister_ftrace_graph(struct fgraph_ops *gops)
1434
1442
unregister_trace_sched_switch (ftrace_graph_probe_sched_switch , NULL );
1435
1443
}
1436
1444
gops -> saved_func = NULL ;
1445
+ out :
1446
+ gops -> ops .flags &= ~FTRACE_OPS_FL_GRAPH ;
1437
1447
}
You can’t perform that action at this time.
0 commit comments