libdtdi-1: Crash in asyn transfer

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

libdtdi-1: Crash in asyn transfer

Uwe Bonnes
When trying async transfer with my FT2232 sync FIFO gadget, I had to apply
appended patch. Probably transfer->status is only set when the transfer is
complete or otherwise aborted.

Does the patch look resonable?
--
Uwe Bonnes                [hidden email]

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
diff --git a/src/ftdi.c b/src/ftdi.c
index 22e746d..f1d3fa5 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1437,8 +1437,9 @@ int ftdi_transfer_data_done(struct ftdi_transfer_control *tc)
             return ret;
         }
     }
-
-    if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED)
+    if (tc->transfer == 0)
+      return 0;
+    else if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED)
         ret = tc->offset;
     else
         ret = -1;

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: libdtdi-1: Crash in asyn transfer

Jie Zhang-2
Hi Uwe,

Sorry for the late reply. What's your host Linux distribution? Is it SuSE?

On Wed, Feb 3, 2010 at 6:36 AM, Uwe Bonnes
<[hidden email]> wrote:
> When trying async transfer with my FT2232 sync FIFO gadget, I had to apply
> appended patch. Probably transfer->status is only set when the transfer is
> complete or otherwise aborted.
>
> Does the patch look resonable?

Return 0 when transfer == NULL is not good. Could you try these two
patches? What's the output with the debug one?


Thanks,
Jie


--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

libftdi-workaround-issue-on-suse-2.diff (2K) Download Attachment
libftdi-workaround-issue-on-suse-2-debug.diff (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: libdtdi-1: Crash in asyn transfer

Jie Zhang-2
In reply to this post by Uwe Bonnes
On Wed, Feb 3, 2010 at 6:36 AM, Uwe Bonnes
<[hidden email]> wrote:
> When trying async transfer with my FT2232 sync FIFO gadget, I had to apply
> appended patch. Probably transfer->status is only set when the transfer is
> complete or otherwise aborted.
>
Recently I fixed a bug in libftdi-1.0. Now it should work on Linux
kernel older than 2.6.23. Could you have a try and see if it fixes
your issue? Thanks.

Jie

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Loading...