All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daejun Park <daejun7.park@samsung.com>
To: "James E . J . Bottomley" <jejb@linux.ibm.com>,
	"Martin K . Petersen" <martin.petersen@oracle.com>,
	Avri Altman <avri.altman@wdc.com>
Cc: "linux-scsi@vger.kernel.org" <linux-scsi@vger.kernel.org>,
	Bart Van Assche <bvanassche@acm.org>,
	Bean Huo <beanhuo@micron.com>,
	ALIM AKHTAR <alim.akhtar@samsung.com>,
	Daejun Park <daejun7.park@samsung.com>
Subject: RE: [PATCH 2/3] scsi: ufs: Map the correct size to the rpmb unit descriptor
Date: Wed, 28 Jul 2021 14:06:39 +0900	[thread overview]
Message-ID: <2038148563.21627450982237.JavaMail.epsvc@epcpadp4> (raw)
In-Reply-To: <20210727123546.17228-3-avri.altman@wdc.com>

Hi Avri,

> diff --git a/drivers/scsi/ufs/ufs.h b/drivers/scsi/ufs/ufs.h
> index 579cf6f9e7a1..d0be8d4c8091 100644
> --- a/drivers/scsi/ufs/ufs.h
> +++ b/drivers/scsi/ufs/ufs.h
> @@ -167,6 +167,7 @@ enum desc_idn {
>          QUERY_DESC_IDN_GEOMETRY                = 0x7,
>          QUERY_DESC_IDN_POWER                = 0x8,
>          QUERY_DESC_IDN_HEALTH           = 0x9,
> +        QUERY_DESC_IDN_UNIT_RPMB        = 0xA,
>          QUERY_DESC_IDN_MAX,

By adding QUERY_DESC_IDN_UNIT_RPMB, the value of QUERY_DESC_IDN_MAX is
changed to 0xB.
...

> diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c
> index 74ccfd2b80ce..eec1bc95391b 100644
> --- a/drivers/scsi/ufs/ufshcd.c
> +++ b/drivers/scsi/ufs/ufshcd.c
> @@ -3319,11 +3319,13 @@ int ufshcd_query_descriptor_retry(struct ufs_hba *hba,
>   * @desc_len: mapped desc length (out)
>   */
>  void ufshcd_map_desc_id_to_length(struct ufs_hba *hba, enum desc_idn desc_id,
> -                                  int *desc_len)
> +                                  int desc_index, int *desc_len)
>  {
>          if (desc_id >= QUERY_DESC_IDN_MAX || desc_id == QUERY_DESC_IDN_RFU_0 ||
>              desc_id == QUERY_DESC_IDN_RFU_1)
>                  *desc_len = 0;

So, if user sending desc_id as 0xA, it can not be detected as invalid descriptor.

> +        else if (desc_index == UFS_UPIU_RPMB_WLUN)
> +                *desc_len = hba->desc_size[QUERY_DESC_IDN_UNIT_RPMB];
>          else
>                  *desc_len = hba->desc_size[desc_id];
>  }

Thanks,
Daejun

  reply	other threads:[~2021-07-28  5:43 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-27 12:35 [PATCH 0/3] Log correct rpmb unit descriptor size Avri Altman
2021-07-27 12:35 ` [PATCH 1/3] scsi: ufs: Remove redundant define Avri Altman
2021-07-29  6:26   ` Bean Huo
2021-07-27 12:35 ` [PATCH 2/3] scsi: ufs: Map the correct size to the rpmb unit descriptor Avri Altman
2021-07-28  5:06   ` Daejun Park [this message]
2021-07-28  7:28     ` Avri Altman
2021-07-28  7:51       ` Daejun Park
2021-07-27 12:35 ` [PATCH 3/3] scsi: ufs: Generalize ufs_is_valid_unit_desc_lun() Avri Altman
2021-08-06  3:03 ` [PATCH 0/3] Log correct rpmb unit descriptor size Martin K. Petersen

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=2038148563.21627450982237.JavaMail.epsvc@epcpadp4 \
    --to=daejun7.park@samsung.com \
    --cc=alim.akhtar@samsung.com \
    --cc=avri.altman@wdc.com \
    --cc=beanhuo@micron.com \
    --cc=bvanassche@acm.org \
    --cc=jejb@linux.ibm.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.