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]
Message-ID: <202012011119.A3816E1B0@keescook>
Date:   Tue, 1 Dec 2020 11:20:15 -0800
From:   Kees Cook <keescook@...omium.org>
To:     Christoph Hellwig <hch@....de>
Cc:     Anton Vorontsov <anton@...msg.org>,
        Colin Cross <ccross@...roid.com>,
        Tony Luck <tony.luck@...el.com>,
        WeiXiong Liao <liaoweixiong@...winnertech.com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 4/9] pstore/blk: remove __unregister_pstore_blk

On Fri, Oct 16, 2020 at 03:20:42PM +0200, Christoph Hellwig wrote:
> Fold __unregister_pstore_blk into its only caller, and merge the
> two identical calls to __unregister_pstore_device that exist in the
> caller now.

Meh, I'm not a fan of this. I like it in a separate function. Pushing it
into the _exit() routine feels weird to me.

> 
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
>  fs/pstore/blk.c | 27 ++++++---------------------
>  1 file changed, 6 insertions(+), 21 deletions(-)
> 
> diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
> index 7f8368e94b3604..3a2214ecf942ae 100644
> --- a/fs/pstore/blk.c
> +++ b/fs/pstore/blk.c
> @@ -388,19 +388,6 @@ static int __register_pstore_blk(void)
>  	return ret;
>  }
>  
> -static void __unregister_pstore_blk(unsigned int major)
> -{
> -	struct pstore_device_info dev = { .read = psblk_generic_blk_read };
> -	void *holder = blkdev;
> -
> -	lockdep_assert_held(&pstore_blk_lock);
> -	if (psblk_bdev && MAJOR(psblk_bdev->bd_dev) == major) {
> -		__unregister_pstore_device(&dev);
> -		psblk_put_bdev(psblk_bdev, holder);
> -		psblk_bdev = NULL;
> -	}
> -}
> -
>  /* get information of pstore/blk */
>  int pstore_blk_get_config(struct pstore_blk_config *info)
>  {
> @@ -430,16 +417,14 @@ late_initcall(pstore_blk_init);
>  
>  static void __exit pstore_blk_exit(void)
>  {
> +	struct pstore_device_info dev = { };
> +
>  	mutex_lock(&pstore_blk_lock);
> +	if (pstore_zone_info)
> +		dev.read = pstore_zone_info->read;
> +	__unregister_pstore_device(&dev);
>  	if (psblk_bdev)
> -		__unregister_pstore_blk(MAJOR(psblk_bdev->bd_dev));
> -	else {
> -		struct pstore_device_info dev = { };
> -
> -		if (pstore_zone_info)
> -			dev.read = pstore_zone_info->read;
> -		__unregister_pstore_device(&dev);
> -	}
> +		psblk_put_bdev(psblk_bdev, blkdev);
>  	mutex_unlock(&pstore_blk_lock);
>  }
>  module_exit(pstore_blk_exit);
> -- 
> 2.28.0
> 

-- 
Kees Cook

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ