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: <CAPDyKFqZ580uHgfob5wfn7a_+Y-q3h0YrvirrNYSFT5Q_St2SA@mail.gmail.com>
Date:   Fri, 7 May 2021 13:34:17 +0200
From:   Ulf Hansson <ulf.hansson@...aro.org>
To:     Christian Löhle <CLoehle@...erstone.com>
Cc:     Avri Altman <Avri.Altman@....com>,
        "adrian.hunter@...el.com" <adrian.hunter@...el.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mmc@...r.kernel.org" <linux-mmc@...r.kernel.org>,
        "axboe@...nel.dk" <axboe@...nel.dk>,
        "zliua@...ron.com" <zliua@...ron.com>
Subject: Re: [PATCH v2] mmc: block: ioctl: No busywaiting of non-TRAN CMDs

On Fri, 7 May 2021 at 12:34, Christian Löhle <CLoehle@...erstone.com> wrote:
>
> Prevent busywaiting for TRAN state indication
> after issuing a command that will not transition
> to TRAN state.
>
> Signed-off-by: Christian Loehle <cloehle@...erstone.com>
> ---
>  drivers/mmc/core/block.c | 17 ++++++++++++++++-
>  1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
> index 689eb9afeeed..48be2ca5e3d1 100644
> --- a/drivers/mmc/core/block.c
> +++ b/drivers/mmc/core/block.c
> @@ -446,6 +446,20 @@ static int card_busy_detect(struct mmc_card *card, unsigned int timeout_ms,
>         return err;
>  }
>
> +static inline bool is_tran_transition_cmd(struct mmc_command *cmd,
> +                                         struct mmc_card *card)
> +{
> +       /* Cards will not be in TRAN after completing identification commands
> +        * or MMC_SEND_STATUS if they are not selected.
> +        */
> +       return !(cmd->opcode == MMC_SEND_CID
> +                       || cmd->opcode == MMC_ALL_SEND_CID
> +                       || cmd->opcode == MMC_SEND_CSD
> +                       || (cmd->opcode == MMC_SEND_STATUS &&
> +                        MMC_EXTRACT_INDEX_FROM_ARG(cmd->arg) != card->rca));
> +
> +}
> +
>  static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
>                                struct mmc_blk_ioc_data *idata)
>  {
> @@ -593,7 +607,8 @@ static int __mmc_blk_ioctl_cmd(struct mmc_card *card, struct mmc_blk_data *md,
>
>         memcpy(&(idata->ic.response), cmd.resp, sizeof(cmd.resp));
>
> -       if (idata->rpmb || (cmd.flags & MMC_RSP_R1B) == MMC_RSP_R1B) {
> +       if ((idata->rpmb || (cmd.flags & MMC_RSP_R1B))
> +                       && is_tran_transition_cmd(&cmd, card)) {

None of the commands you are checking for should have an R1B response
according to the spec, I think.

That said, I don't think we should do these kinds of sanity checks in
the kernel for the mmc ioctls, that just doesn't scale.

>                 /*
>                  * Ensure RPMB/R1B command has completed by polling CMD13
>                  * "Send Status".
> --

Kind regards
Uffe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ