From a345c19cc2d4e9556b46b48d75b8ccc35b95ba45 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 17 Apr 2012 13:39:09 -0700 Subject: recv: only inspect tsf on timestamp error check --- host/lib/transport/super_recv_packet_handler.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'host/lib') diff --git a/host/lib/transport/super_recv_packet_handler.hpp b/host/lib/transport/super_recv_packet_handler.hpp index 74fbe82fb..205c7a3a3 100644 --- a/host/lib/transport/super_recv_packet_handler.hpp +++ b/host/lib/transport/super_recv_packet_handler.hpp @@ -306,7 +306,7 @@ private: #endif //3) check for out of order timestamps - if (info.ifpi.has_tsi and info.ifpi.has_tsf and prev_buffer_info[index].time > info.time){ + if (info.ifpi.has_tsf and prev_buffer_info[index].time > info.time){ return PACKET_TIMESTAMP_ERROR; } -- cgit v1.2.3 From 4a1ec80d496e7754cf5a8c0f96322b2871094a31 Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Tue, 17 Apr 2012 14:07:58 -0700 Subject: usb: do not release recv buffer in wrapper The actual recv buffer will be automatically released when dereferenced. By releasing this buffer early we allowed for a race condition: Subsequent wrapper buffers that shared the same actual buffer could get their memory filled by new recvd packets from the USB layer. --- host/lib/transport/usb_zero_copy_wrapper.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'host/lib') diff --git a/host/lib/transport/usb_zero_copy_wrapper.cpp b/host/lib/transport/usb_zero_copy_wrapper.cpp index 690e5aaa2..3571ed856 100644 --- a/host/lib/transport/usb_zero_copy_wrapper.cpp +++ b/host/lib/transport/usb_zero_copy_wrapper.cpp @@ -35,10 +35,9 @@ public: _queue(queue){/*NOP*/} void release(void){ - if (_mrb.get() == NULL) return; - _mrb->release(); + if (not _mrb) return; + _mrb.reset(); //decrement ref count, other MRB's may hold a ref _queue.push_with_haste(this); - _mrb.reset(); } UHD_INLINE sptr get_new(managed_recv_buffer::sptr mrb, const void *mem, size_t len){ -- cgit v1.2.3