lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 2 Apr 2024 14:31:31 +0200
From: Jiri Pirko <jiri@...nulli.us>
To: Johannes Berg <johannes@...solutions.net>
Cc: netdev@...r.kernel.org, jhs@...atatu.com, victor@...atatu.com,
	kuba@...nel.org, pctammela@...atatu.com, martin@...ongswan.org,
	horms@...nel.org, Johannes Berg <johannes.berg@...el.com>
Subject: Re: [PATCH net-next v2 1/2] rtnetlink: add guard for RTNL

Thu, Mar 28, 2024 at 08:27:49AM CET, johannes@...solutions.net wrote:
>From: Johannes Berg <johannes.berg@...el.com>
>
>The new guard/scoped_gard can be useful for the RTNL as well,
>so add a guard definition for it. It gets used like
>
> {
>   guard(rtnl)();
>   // RTNL held until end of block
> }
>
>or
>
>  scoped_guard(rtnl) {
>    // RTNL held in this block
>  }
>
>as with any other guard/scoped_guard.
>
>Signed-off-by: Johannes Berg <johannes.berg@...el.com>

Since you add couple of helpers, I believe it is a nice custom to add a
couple of patches that actually uses them. Would that make sense?


>---
>v2: resend
>---
> include/linux/rtnetlink.h | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
>index cdfc897f1e3c..a7da7dfc06a2 100644
>--- a/include/linux/rtnetlink.h
>+++ b/include/linux/rtnetlink.h
>@@ -7,6 +7,7 @@
> #include <linux/netdevice.h>
> #include <linux/wait.h>
> #include <linux/refcount.h>
>+#include <linux/cleanup.h>
> #include <uapi/linux/rtnetlink.h>
> 
> extern int rtnetlink_send(struct sk_buff *skb, struct net *net, u32 pid, u32 group, int echo);
>@@ -46,6 +47,8 @@ extern int rtnl_is_locked(void);
> extern int rtnl_lock_killable(void);
> extern bool refcount_dec_and_rtnl_lock(refcount_t *r);
> 
>+DEFINE_LOCK_GUARD_0(rtnl, rtnl_lock(), rtnl_unlock())
>+
> extern wait_queue_head_t netdev_unregistering_wq;
> extern atomic_t dev_unreg_count;
> extern struct rw_semaphore pernet_ops_rwsem;
>-- 
>2.44.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ