Need a pairing decrement for mos_parport's refcount if write_parport_reg_nonblock fails?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

While analyzing the v5.0 source, I notice that when write_parport_reg_nonblock failed and return -ENOMEN, 

the refcount of mos_parport increased by kref_get didn't decreased even after return to the caller write_parport_reg_nonblock:

      kref_get(&mos_parport->ref_count); 
      urbtrack->mos_parport = mos_parport; 
      urbtrack->urb = usb_alloc_urb(0, GFP_ATOMIC); 
      if (!urbtrack->urb) {
          kfree(urbtrack); 
          return -ENOMEM; 
      } 
      urbtrack->setup = kmalloc(sizeof(*urbtrack->setup), GFP_ATOMIC); 
      if (!urbtrack->setup) { 
          usb_free_urb(urbtrack->urb); 
          kfree(urbtrack); 
          return -ENOMEM;
      }

can this lead to the imbalance of the mos_parport's refcount? though the ENOMEN almost won't be trigger.

Best Regards

Lin Yi









[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux