[close] Attachments you submit will be routed for moderation. If you have an account, please log in first.

Ticket #81: linux-prevent-double-free-of-urbs-on-device-disconnect.patch

File linux-prevent-double-free-of-urbs-on-device-disconnect.patch, 1.1 KB (added by pbatard, 4 years ago)
  • libusb/os/linux_usbfs.c

    From 4fecdc3ee760a0c8c7b7f8d602609e9ed0b747c6 Mon Sep 17 00:00:00 2001
    From: Pete Batard <pbatard@gmail.com>
    Date: Thu, 16 Jun 2011 10:49:13 +0100
    Subject: [PATCH] [linux] prevent double free of urbs on device disconnect
    
    * Trac #81
    ---
     libusb/os/linux_usbfs.c |    5 +++++
     1 files changed, 5 insertions(+), 0 deletions(-)
    
    diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
    index 72db57a..2cf973c 100644
    a b static void op_clear_transfer_priv(struct usbi_transfer *itransfer) 
    17491749        case LIBUSB_TRANSFER_TYPE_CONTROL: 
    17501750        case LIBUSB_TRANSFER_TYPE_BULK: 
    17511751        case LIBUSB_TRANSFER_TYPE_INTERRUPT: 
     1752                /* urbs can have been freed during submit transfer => mutex */ 
     1753                usbi_mutex_lock(&itransfer->lock); 
    17521754                free(tpriv->urbs); 
    17531755                tpriv->urbs = NULL; 
     1756                usbi_mutex_unlock(&itransfer->lock); 
    17541757                break; 
    17551758        case LIBUSB_TRANSFER_TYPE_ISOCHRONOUS: 
     1759                usbi_mutex_lock(&itransfer->lock); 
    17561760                free_iso_urbs(tpriv); 
     1761                usbi_mutex_unlock(&itransfer->lock); 
    17571762                break; 
    17581763        default: 
    17591764                usbi_err(TRANSFER_CTX(transfer),