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>] [day] [month] [year] [list]
Date:   Fri, 12 Nov 2021 09:57:38 +0100
From:   Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To:     Aayush Agarwal <aayush.a.agarwal@...cle.com>
Cc:     Evan Xuan <jian.xuan@...cle.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        Amey Narkhede <ameynarkhede03@...il.com>,
        Bjorn Helgaas <bhelgaas@...gle.com>,
        Christophe JAILLET <christophe.jaillet@...adoo.fr>,
        Lee Jones <lee.jones@...aro.org>, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: cavium/nitrox - Fix 'File exists' error in
 'nitrox_probe()'

On Fri, Nov 12, 2021 at 12:54:00AM -0800, Aayush Agarwal wrote:
> When two cavium cards are inserted and on booting OS,
> nitrox_debugfs_init() is called twice and thus tries to create
> 'n5pf' directory twice inside '/'. This causes the 'File exists' error.
> 
> This error was handled before
> 'commit 97a93b2b5839 ("crypto: cavium/nitrox - no need to check return
> value of debugfs_create functions")'
> 
> This commit handles the error by redirecting the code by checking
> if 'n5pf' directory exists already using 'debugfs_lookup()' function.
> 
> Tested-by: Evan Xuan <jian.xuan@...cle.com>
> Signed-off-by: Aayush Agarwal <aayush.a.agarwal@...cle.com>
> ---
>  drivers/crypto/cavium/nitrox/nitrox_main.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c
> index 6c61817996a3..1eee05e30f05 100644
> --- a/drivers/crypto/cavium/nitrox/nitrox_main.c
> +++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
> @@ -7,6 +7,7 @@
>  #include <linux/mutex.h>
>  #include <linux/pci.h>
>  #include <linux/pci_ids.h>
> +#include <linux/debugfs.h>
>  
>  #include "nitrox_dev.h"
>  #include "nitrox_common.h"
> @@ -479,6 +480,13 @@ static int nitrox_probe(struct pci_dev *pdev,
>  	if (err)
>  		goto pf_hw_fail;
>  
> +	struct dentry *check_dir = debugfs_lookup(KBUILD_MODNAME, NULL);
> +
> +	if (check_dir != NULL) {
> +		dput(check_dir);
> +		goto pf_hw_fail;

Why is this a "failure"?

> +	}
> +
>  	nitrox_debugfs_init(ndev);

Why not just put the "check" logic in this function instead?
You want to have per-device directories in debugfs for this device,
right?  If so, then this function should handle that, not the
nitrox_probe() call.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ