[prev in list] [next in list] [prev in thread] [next in thread] 

List:       flashrom
Subject:    Re: [flashrom] [PATCH 2/2] dediprog: Fix bug where too many transfers would be queued
From:       David Hendricks <david.hendricks () gmail ! com>
Date:       2016-05-07 21:45:33
Message-ID: CAJ_ov57-Jv9rKF6cm=PZcRV5vfSmTbxDLC6bc9dwXjRHVBcQQg () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Looks good to me.

Acked-by: David Hendricks <david.hendricks@gmail.com>

On Wed, May 4, 2016 at 4:37 AM, Nico Huber <nico.huber@secunet.com> wrote:

> We didn't check the total number of queued transfers in the inner most
> loop. Up to DEDIPROG_ASYNC_TRANSFERS - 1 invalid transfers could be
> queued therefore. So add another check on the total number.
>
> Signed-off-by: Nico Huber <nico.huber@secunet.com>
> ---
>  dediprog.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/dediprog.c b/dediprog.c
> index b7276e5..6f82772 100644
> --- a/dediprog.c
> +++ b/dediprog.c
> @@ -462,7 +462,9 @@ static int dediprog_spi_bulk_read(struct flashctx
> *flash, uint8_t *buf, unsigned
>
>         /* Now transfer requested chunks using libusb's asynchronous
> interface. */
>         while (!status.error && (status.queued_idx < count)) {
> -               while ((status.queued_idx - status.finished_idx) <
> DEDIPROG_ASYNC_TRANSFERS) {
> +               while ((status.queued_idx < count) &&
> +                      (status.queued_idx - status.finished_idx) <
> DEDIPROG_ASYNC_TRANSFERS)
> +               {
>                         transfer = transfers[status.queued_idx %
> DEDIPROG_ASYNC_TRANSFERS];
>                         libusb_fill_bulk_transfer(transfer,
> dediprog_handle, 0x80 | dediprog_in_endpoint,
>                                         (unsigned char *)buf +
> status.queued_idx * chunksize, chunksize,
> --
> 2.7.0
>
>
> _______________________________________________
> flashrom mailing list
> flashrom@flashrom.org
> https://www.flashrom.org/mailman/listinfo/flashrom
>

[Attachment #5 (text/html)]

<div dir="ltr"><div>Looks good to me.</div><div><br></div><div>Acked-by: David \
Hendricks &lt;<a href="mailto:david.hendricks@gmail.com">david.hendricks@gmail.com</a>&gt;</div></div><div \
class="gmail_extra"><br><div class="gmail_quote">On Wed, May 4, 2016 at 4:37 AM, Nico \
Huber <span dir="ltr">&lt;<a href="mailto:nico.huber@secunet.com" \
target="_blank">nico.huber@secunet.com</a>&gt;</span> wrote:<br><blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">We didn&#39;t check the total number of queued transfers in \
the inner most<br> loop. Up to DEDIPROG_ASYNC_TRANSFERS - 1 invalid transfers could \
be<br> queued therefore. So add another check on the total number.<br>
<br>
Signed-off-by: Nico Huber &lt;<a \
                href="mailto:nico.huber@secunet.com">nico.huber@secunet.com</a>&gt;<br>
                
---<br>
  dediprog.c | 4 +++-<br>
  1 file changed, 3 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/dediprog.c b/dediprog.c<br>
index b7276e5..6f82772 100644<br>
--- a/dediprog.c<br>
+++ b/dediprog.c<br>
@@ -462,7 +462,9 @@ static int dediprog_spi_bulk_read(struct flashctx *flash, uint8_t \
*buf, unsigned<br> <br>
            /* Now transfer requested chunks using libusb&#39;s asynchronous \
                interface. */<br>
            while (!status.error &amp;&amp; (status.queued_idx &lt; count)) {<br>
-                       while ((status.queued_idx - status.finished_idx) &lt; \
DEDIPROG_ASYNC_TRANSFERS) {<br> +                       while ((status.queued_idx \
&lt; count) &amp;&amp;<br> +                                 (status.queued_idx - \
status.finished_idx) &lt; DEDIPROG_ASYNC_TRANSFERS)<br> +                       {<br>
                                    transfer = transfers[status.queued_idx % \
                DEDIPROG_ASYNC_TRANSFERS];<br>
                                    libusb_fill_bulk_transfer(transfer, \
                dediprog_handle, 0x80 | dediprog_in_endpoint,<br>
                                                            (unsigned char *)buf + \
status.queued_idx * chunksize, chunksize,<br> <span class="HOEnZb"><font \
color="#888888">--<br> 2.7.0<br>
<br>
<br>
_______________________________________________<br>
flashrom mailing list<br>
<a href="mailto:flashrom@flashrom.org">flashrom@flashrom.org</a><br>
<a href="https://www.flashrom.org/mailman/listinfo/flashrom" rel="noreferrer" \
target="_blank">https://www.flashrom.org/mailman/listinfo/flashrom</a><br> \
</font></span></blockquote></div><br></div>



_______________________________________________
flashrom mailing list
flashrom@flashrom.org
https://www.flashrom.org/mailman/listinfo/flashrom

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic