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:   Fri, 22 Apr 2022 06:41:45 -1000
From:   Tejun Heo <tj@...nel.org>
To:     Imran Khan <imran.f.khan@...cle.com>
Cc:     viro@...iv.linux.org.uk, gregkh@...uxfoundation.org,
        ebiederm@...ssion.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 03/10] kernfs: Change kernfs_notify_list to llist.

Hello,

On Sun, Apr 10, 2022 at 12:37:12PM +1000, Imran Khan wrote:
> @@ -846,18 +845,25 @@ static void kernfs_notify_workfn(struct work_struct *work)
>  	struct kernfs_node *kn;
>  	struct kernfs_super_info *info;
>  	struct kernfs_root *root;
> +	struct llist_node *free;
> +	struct kernfs_elem_attr *attr;
>  repeat:
> -	/* pop one off the notify_list */
> +	/**
> +	 * pop one off the notify_list.
> +	 * There can be multiple concurrent work items.
> +	 * Use kernfs_notify_lock to synchronize between multipl consumers.
> +	 */

This is running off of a single work item, so there can only be one instance
of this running at any given time.

>  	spin_lock_irq(&kernfs_notify_lock);
> -	kn = kernfs_notify_list;
> -	if (kn == KERNFS_NOTIFY_EOL) {
> +	if (llist_empty(&kernfs_notify_list)) {
>  		spin_unlock_irq(&kernfs_notify_lock);
>  		return;
>  	}
> -	kernfs_notify_list = kn->attr.notify_next;
> -	kn->attr.notify_next = NULL;
> +
> +	free = llist_del_first(&kernfs_notify_list);

Why not just test whether the returned pointer is NULL here instead of doing
a separate empty check above?

Thanks.

-- 
tejun

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ