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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Sat, 22 Feb 2020 12:25:36 +0530
From:   Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
To:     Jiri Pirko <jiri@...nulli.us>
Cc:     madhuparnabhowmik10@...il.com, jiri@...lanox.com,
        davem@...emloft.net, netdev@...r.kernel.org,
        linux-kernel@...r.kernel.org, joel@...lfernandes.org,
        frextrite@...il.com,
        linux-kernel-mentees@...ts.linuxfoundation.org, paulmck@...nel.org
Subject: Re: [PATCH] net: core: devlink.c: Hold devlink->lock from the
 beginning of devlink_dpipe_table_register()

On Sat, Feb 22, 2020 at 07:26:40AM +0100, Jiri Pirko wrote:
> Fri, Feb 21, 2020 at 07:09:43PM CET, madhuparnabhowmik10@...il.com wrote:
> >From: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
> >
> >devlink_dpipe_table_find() should be called under either
> >rcu_read_lock() or devlink->lock. devlink_dpipe_table_register()
> >calls devlink_dpipe_table_find() without holding the lock
> >and acquires it later. Therefore hold the devlink->lock
> >from the beginning of devlink_dpipe_table_register().
> >
> >Suggested-by: Jiri Pirko <jiri@...lanox.com>
> >Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>
> >---
> > net/core/devlink.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> >diff --git a/net/core/devlink.c b/net/core/devlink.c
> >index 3e8c94155d93..d54e1f156b6f 100644
> >--- a/net/core/devlink.c
> >+++ b/net/core/devlink.c
> >@@ -6840,6 +6840,8 @@ int devlink_dpipe_table_register(struct devlink *devlink,
> > {
> > 	struct devlink_dpipe_table *table;
> > 
> >+	mutex_lock(&devlink->lock);
> >+
> > 	if (devlink_dpipe_table_find(&devlink->dpipe_table_list, table_name))
> > 		return -EEXIST;
> 
> You have to handle the error path.
>
Sure, I have sent the updated patch.

Thank you,
Madhuparna
> 
> > 
> >@@ -6855,7 +6857,6 @@ int devlink_dpipe_table_register(struct devlink *devlink,
> > 	table->priv = priv;
> > 	table->counter_control_extern = counter_control_extern;
> > 
> >-	mutex_lock(&devlink->lock);
> > 	list_add_tail_rcu(&table->list, &devlink->dpipe_table_list);
> > 	mutex_unlock(&devlink->lock);
> > 	return 0;
> >-- 
> >2.17.1
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ