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] [thread-next>] [day] [month] [year] [list]
Message-ID: <YPr4ubrFPQ1Pd5mE@gmail.com>
Date:   Fri, 23 Jul 2021 10:13:29 -0700
From:   Eric Biggers <ebiggers@...nel.org>
To:     Satya Tangirala <satyaprateek2357@...il.com>
Cc:     linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jens Axboe <axboe@...nel.dk>,
        Satya Tangirala <satyat@...gle.com>
Subject: Re: [PATCH v4 5/9] ufshcd: handle error from blk_ksm_register()

On Tue, Jul 06, 2021 at 10:29:39PM -0700, Satya Tangirala wrote:
> From: Satya Tangirala <satyat@...gle.com>
> 
> Handle any error from blk_ksm_register() in the callers. Previously,
> the callers ignored the return value because blk_ksm_register() wouldn't
> fail as long as the request_queue didn't have integrity support too, but
> as this is no longer the case, it's safer for the callers to just handle
> the return value appropriately.
> 
> Signed-off-by: Satya Tangirala <satyat@...gle.com>
> ---
>  drivers/scsi/ufs/ufshcd-crypto.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/scsi/ufs/ufshcd-crypto.c b/drivers/scsi/ufs/ufshcd-crypto.c
> index d70cdcd35e43..0fcf9d6752f8 100644
> --- a/drivers/scsi/ufs/ufshcd-crypto.c
> +++ b/drivers/scsi/ufs/ufshcd-crypto.c
> @@ -233,6 +233,15 @@ void ufshcd_init_crypto(struct ufs_hba *hba)
>  void ufshcd_crypto_setup_rq_keyslot_manager(struct ufs_hba *hba,
>  					    struct request_queue *q)
>  {
> -	if (hba->caps & UFSHCD_CAP_CRYPTO)
> -		blk_ksm_register(&hba->ksm, q);
> +	if (hba->caps & UFSHCD_CAP_CRYPTO) {
> +		/*
> +		 * This WARN_ON should never trigger since &hba->ksm won't be
> +		 * "empty" (i.e. will support at least 1 crypto capability), a
> +		 * UFS device's request queue doesn't support integrity, and
> +		 * it also satisfies all the block layer constraints (i.e.
> +		 * supports SG gaps, doesn't have chunk sectors, has a
> +		 * sufficiently large supported max_segments per bio)
> +		 */
> +		WARN_ON(!blk_ksm_register(&hba->ksm, q));
> +	}

I guess this looks okay, but I think the comment should be a bit more concise
and not so tied to the current implementation details, like:

                /*
                 * This WARN_ON should never trigger since at least one of the
                 * declared crypto capabilities should be compatible with the
                 * UFS device, otherwise the UFS host driver shouldn't have
                 * declared crypto support at all.
                 */

Likewise for the similar MMC crypto patch.

- Eric

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ