lkml.org 
[lkml]   [2022]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 24/25] usb: gadget: f_tcm: Check overlapped command
On 2022-07-18 18:28:34 [-0700], Thinh Nguyen wrote:
> diff --git a/drivers/usb/gadget/function/f_tcm.c b/drivers/usb/gadget/function/f_tcm.c
> index 8b99ee07df87..dfa3e7c043a3 100644
> --- a/drivers/usb/gadget/function/f_tcm.c
> +++ b/drivers/usb/gadget/function/f_tcm.c
> @@ -1214,6 +1233,51 @@ static void usbg_cmd_work(struct work_struct *work)
> return;
>
> skip:
> + if (cmd->tmr_rsp == RC_OVERLAPPED_TAG) {
> + struct se_session *se_sess;
> + struct uas_stream *stream;
> +
> + se_sess = cmd->fu->tpg->tpg_nexus->tvn_se_sess;
> + stream = uasp_get_stream_by_tag(cmd->fu, cmd->tag);
> +
> + /*
> + * There's no guarantee of a matching completion order between
> + * different endpoints. i.e. The device may receive a new (CDB)
> + * command request completion of the command endpoint before it
> + * gets notified of the previous command status completion from
> + * a status endpoint. The driver still needs to detect
> + * misbehaving host and respond with an overlap command tag. To
> + * prevent false overlapped tag failure, give the active and
> + * matching stream id a short time (1ms) to complete before
> + * respond with overlapped command failure.
> + */
> + msleep(1);

How likely is it for this to happen? Is there maybe some synchronisation
missing? If I see this right, in order to get here, you will already
spill the message "Command tag %d overlapped" which does not look good.
Why should the host re-use a tag which did not yet complete?

Sebastian

\
 
 \ /
  Last update: 2022-08-26 12:47    [W:0.263 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site