File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -297,6 +297,7 @@ static inline int check_net(const struct net *net)
297
297
}
298
298
299
299
void net_drop_ns (void * );
300
+ void net_passive_dec (struct net * net );
300
301
301
302
#else
302
303
@@ -326,8 +327,18 @@ static inline int check_net(const struct net *net)
326
327
}
327
328
328
329
#define net_drop_ns NULL
330
+
331
+ static inline void net_passive_dec (struct net * net )
332
+ {
333
+ refcount_dec (& net -> passive );
334
+ }
329
335
#endif
330
336
337
+ static inline void net_passive_inc (struct net * net )
338
+ {
339
+ refcount_inc (& net -> passive );
340
+ }
341
+
331
342
/* Returns true if the netns initialization is completed successfully */
332
343
static inline bool net_initialized (const struct net * net )
333
344
{
Original file line number Diff line number Diff line change @@ -464,7 +464,7 @@ static void net_complete_free(void)
464
464
465
465
}
466
466
467
- static void net_free (struct net * net )
467
+ void net_passive_dec (struct net * net )
468
468
{
469
469
if (refcount_dec_and_test (& net -> passive )) {
470
470
kfree (rcu_access_pointer (net -> gen ));
@@ -482,7 +482,7 @@ void net_drop_ns(void *p)
482
482
struct net * net = (struct net * )p ;
483
483
484
484
if (net )
485
- net_free (net );
485
+ net_passive_dec (net );
486
486
}
487
487
488
488
struct net * copy_net_ns (unsigned long flags ,
@@ -523,7 +523,7 @@ struct net *copy_net_ns(unsigned long flags,
523
523
key_remove_domain (net -> key_domain );
524
524
#endif
525
525
put_user_ns (user_ns );
526
- net_free (net );
526
+ net_passive_dec (net );
527
527
dec_ucounts :
528
528
dec_net_namespaces (ucounts );
529
529
return ERR_PTR (rv );
@@ -672,7 +672,7 @@ static void cleanup_net(struct work_struct *work)
672
672
key_remove_domain (net -> key_domain );
673
673
#endif
674
674
put_user_ns (net -> user_ns );
675
- net_free (net );
675
+ net_passive_dec (net );
676
676
}
677
677
cleanup_net_task = NULL ;
678
678
}
You can’t perform that action at this time.
0 commit comments