linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Satya Tangirala <satyat@google.com>
Cc: linux-scsi@vger.kernel.org, Kim Boojin <boojin.kim@samsung.com>,
	Kuohong Wang <kuohong.wang@mediatek.com>,
	Eric Biggers <ebiggers@google.com>,
	Barani Muthukumaran <bmuthuku@qti.qualcomm.com>,
	linux-f2fs-devel@lists.sourceforge.net,
	linux-block@vger.kernel.org, linux-fscrypt@vger.kernel.org,
	linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: [f2fs-dev] [PATCH v10 02/12] block: Keyslot Manager for Inline Encryption
Date: Wed, 22 Apr 2020 02:22:50 -0700	[thread overview]
Message-ID: <20200422092250.GA12290@infradead.org> (raw)
In-Reply-To: <20200408035654.247908-3-satyat@google.com>

> +bool blk_ksm_crypto_cfg_supported(struct blk_keyslot_manager *ksm,
> +				  const struct blk_crypto_config *cfg)
> +{
> +	if (!ksm)
> +		return false;
> +	return (ksm->crypto_modes_supported[cfg->crypto_mode] &
> +		cfg->data_unit_size) &&
> +	       (ksm->max_dun_bytes_supported >= cfg->dun_bytes);

Nit: why not expand this a bit to be more readable:

	if (!(ksm->crypto_modes_supported[cfg->crypto_mode] &
			cfg->data_unit_size))
		return false;
	if (ksm->max_dun_bytes_supported < cfg->dun_bytes)
		return false;
	return true;

> +int blk_ksm_evict_key(struct blk_keyslot_manager *ksm,
> +		      const struct blk_crypto_key *key)
> +{
> +	struct blk_ksm_keyslot *slot;
> +	int err = 0;
> +
> +	blk_ksm_hw_enter(ksm);
> +	slot = blk_ksm_find_keyslot(ksm, key);
> +	if (!slot)
> +		goto out_unlock;
> +
> +	if (atomic_read(&slot->slot_refs) != 0) {
> +		err = -EBUSY;
> +		goto out_unlock;
> +	}

This check looks racy.


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2020-04-22  9:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-08  3:56 [f2fs-dev] [PATCH v10 00/12] Inline Encryption Support Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 01/12] Documentation: Document the blk-crypto framework Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 02/12] block: Keyslot Manager for Inline Encryption Satya Tangirala via Linux-f2fs-devel
2020-04-22  9:22   ` Christoph Hellwig [this message]
2020-04-28  2:14     ` Satya Tangirala via Linux-f2fs-devel
2020-04-28  2:46       ` Eric Biggers
2020-04-28  2:57         ` Eric Biggers
2020-04-28  5:19           ` Christoph Hellwig
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 03/12] block: Inline encryption support for blk-mq Satya Tangirala via Linux-f2fs-devel
2020-04-22  9:35   ` Christoph Hellwig
2020-04-28  2:54     ` Satya Tangirala via Linux-f2fs-devel
2020-04-28  5:21       ` Christoph Hellwig
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 04/12] block: Make blk-integrity preclude hardware inline encryption Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 05/12] block: blk-crypto-fallback for Inline Encryption Satya Tangirala via Linux-f2fs-devel
2020-04-22  9:37   ` Christoph Hellwig
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 06/12] scsi: ufs: UFS driver v2.1 spec crypto additions Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 07/12] scsi: ufs: UFS crypto API Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 08/12] scsi: ufs: Add inline encryption support to UFS Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 09/12] fs: introduce SB_INLINECRYPT Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 10/12] fscrypt: add inline encryption support Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 11/12] f2fs: " Satya Tangirala via Linux-f2fs-devel
2020-04-08  3:56 ` [f2fs-dev] [PATCH v10 12/12] ext4: " Satya Tangirala via Linux-f2fs-devel
2020-04-08  4:18 ` [f2fs-dev] [PATCH v10 00/12] Inline Encryption Support Eric Biggers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200422092250.GA12290@infradead.org \
    --to=hch@infradead.org \
    --cc=bmuthuku@qti.qualcomm.com \
    --cc=boojin.kim@samsung.com \
    --cc=ebiggers@google.com \
    --cc=kuohong.wang@mediatek.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=satyat@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).