1. 23 3月, 2021 5 次提交
    • J
      USB: cdc-acm: fix use-after-free after probe failure · 4e49bf37
      Johan Hovold 提交于
      If tty-device registration fails the driver would fail to release the
      data interface. When the device is later disconnected, the disconnect
      callback would still be called for the data interface and would go about
      releasing already freed resources.
      
      Fixes: c93d8195 ("usb: cdc-acm: fix error handling in acm_probe()")
      Cc: stable@vger.kernel.org      # 3.9
      Cc: Alexey Khoroshilov <khoroshilov@ispras.ru>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210322155318.9837-3-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4e49bf37
    • J
      USB: cdc-acm: fix double free on probe failure · 7180495c
      Johan Hovold 提交于
      If tty-device registration fails the driver copy of any Country
      Selection functional descriptor would end up being freed twice; first
      explicitly in the error path and then again in the tty-port destructor.
      
      Drop the first erroneous free that was left when fixing a tty-port
      resource leak.
      
      Fixes: cae2bc76 ("usb: cdc-acm: Decrement tty port's refcount if probe() fail")
      Cc: stable@vger.kernel.org      # 4.19
      Cc: Jaejoong Kim <climbbb.kim@gmail.com>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Link: https://lore.kernel.org/r/20210322155318.9837-2-johan@kernel.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7180495c
    • O
      USB: cdc-acm: downgrade message to debug · e4c77070
      Oliver Neukum 提交于
      This failure is so common that logging an error here amounts
      to spamming log files.
      Reviewed-by: NBruno Thomsen <bruno.thomsen@gmail.com>
      Signed-off-by: NOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210311130126.15972-2-oneukum@suse.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e4c77070
    • O
      USB: cdc-acm: untangle a circular dependency between callback and softint · 6069e3e9
      Oliver Neukum 提交于
      We have a cycle of callbacks scheduling works which submit
      URBs with thos callbacks. This needs to be blocked, stopped
      and unblocked to untangle the circle.
      
      The issue leads to faults like:
      
      [   55.068392] Unable to handle kernel paging request at virtual address 6b6b6c03
      [   55.075624] pgd = be866494
      [   55.078335] [6b6b6c03] *pgd=00000000
      [   55.081924] Internal error: Oops: 5 [#1] PREEMPT SMP ARM
      [   55.087238] Modules linked in: ppp_async crc_ccitt ppp_generic slhc
      xt_TCPMSS xt_tcpmss xt_hl nf_log_ipv6 nf_log_ipv4 nf_log_common
      xt_policy xt_limit xt_conntrack xt_tcpudp xt_pkttype ip6table_mangle
      iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4
      iptable_mangle ip6table_filter ip6_tables iptable_filter ip_tables
      des_generic md5 sch_fq_codel cdc_mbim cdc_wdm cdc_ncm usbnet mii
      cdc_acm usb_storage ip_tunnel xfrm_user xfrm6_tunnel tunnel6
      xfrm4_tunnel tunnel4 esp6 esp4 ah6 ah4 xfrm_algo xt_LOG xt_LED
      xt_comment x_tables ipv6
      [   55.134954] CPU: 0 PID: 82 Comm: kworker/0:2 Tainted: G
         T 5.8.17 #1
      [   55.142526] Hardware name: Freescale i.MX7 Dual (Device Tree)
      [   55.148304] Workqueue: events acm_softint [cdc_acm]
      [   55.153196] PC is at kobject_get+0x10/0xa4
      [   55.157302] LR is at usb_get_dev+0x14/0x1c
      [   55.161402] pc : [<8047c06c>]    lr : [<80560448>]    psr: 20000193
      [   55.167671] sp : bca39ea8  ip : 00007374  fp : bf6cbd80
      [   55.172899] r10: 00000000  r9 : bdd92284  r8 : bdd92008
      [   55.178128] r7 : 6b6b6b6b  r6 : fffffffe  r5 : 60000113  r4 : 6b6b6be3
      [   55.184658] r3 : 6b6b6b6b  r2 : 00000111  r1 : 00000000  r0 : 6b6b6be3
      [   55.191191] Flags: nzCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM Segment none
      [   55.198417] Control: 10c5387d  Table: bcf0c06a  DAC: 00000051
      [   55.204168] Process kworker/0:2 (pid: 82, stack limit = 0x9bdd2a89)
      [   55.210439] Stack: (0xbca39ea8 to 0xbca3a000)
      [   55.214805] 9ea0:                   bf6cbd80 80769a50 6b6b6b6b 80560448 bdeb0500 8056bfe8
      [   55.222991] 9ec0: 00000002 b76da000 00000000 bdeb0500 bdd92448 bca38000 bdeb0510 8056d69c
      [   55.231177] 9ee0: bca38000 00000000 80c050fc 00000000 bca39f44 09d42015 00000000 00000001
      [   55.239363] 9f00: bdd92448 bdd92438 bdd92000 7f1158c4 bdd92448 bca2ee00 bf6cbd80 bf6cef00
      [   55.247549] 9f20: 00000000 00000000 00000000 801412d8 bf6cbd98 80c03d00 bca2ee00 bf6cbd80
      [   55.255735] 9f40: bca2ee14 bf6cbd98 80c03d00 00000008 bca38000 80141568 00000000 80c446ae
      [   55.263921] 9f60: 00000000 bc9ed880 bc9f0700 bca38000 bc117eb4 80141524 bca2ee00 bc9ed8a4
      [   55.272107] 9f80: 00000000 80147cc8 00000000 bc9f0700 80147b84 00000000 00000000 00000000
      [   55.280292] 9fa0: 00000000 00000000 00000000 80100148 00000000 00000000 00000000 00000000
      [   55.288477] 9fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
      [   55.296662] 9fe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
      [   55.304860] [<8047c06c>] (kobject_get) from [<80560448>] (usb_get_dev+0x14/0x1c)
      [   55.312271] [<80560448>] (usb_get_dev) from [<8056bfe8>] (usb_hcd_unlink_urb+0x50/0xd8)
      [   55.320286] [<8056bfe8>] (usb_hcd_unlink_urb) from [<8056d69c>] (usb_kill_urb.part.0+0x44/0xd0)
      [   55.329004] [<8056d69c>] (usb_kill_urb.part.0) from [<7f1158c4>] (acm_softint+0x4c/0x10c [cdc_acm])
      [   55.338082] [<7f1158c4>] (acm_softint [cdc_acm]) from [<801412d8>] (process_one_work+0x19c/0x3e8)
      [   55.346969] [<801412d8>] (process_one_work) from [<80141568>] (worker_thread+0x44/0x4dc)
      [   55.355072] [<80141568>] (worker_thread) from [<80147cc8>] (kthread+0x144/0x180)
      [   55.362481] [<80147cc8>] (kthread) from [<80100148>] (ret_from_fork+0x14/0x2c)
      [   55.369706] Exception stack(0xbca39fb0 to 0xbca39ff8)
      Tested-by: NBruno Thomsen <bruno.thomsen@gmail.com>
      Signed-off-by: NOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210311130126.15972-1-oneukum@suse.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6069e3e9
    • O
      cdc-acm: fix BREAK rx code path adding necessary calls · 08dff274
      Oliver Neukum 提交于
      Counting break events is nice but we should actually report them to
      the tty layer.
      
      Fixes: 5a6a62bd ("cdc-acm: add TIOCMIWAIT")
      Signed-off-by: NOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20210311133714.31881-1-oneukum@suse.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      08dff274
  2. 10 3月, 2021 1 次提交
  3. 21 1月, 2021 1 次提交
  4. 28 12月, 2020 1 次提交
  5. 13 11月, 2020 1 次提交
  6. 28 10月, 2020 1 次提交
  7. 05 10月, 2020 1 次提交
    • V
      usb: cdc-acm: add quirk to blacklist ETAS ES58X devices · a4f88430
      Vincent Mailhol 提交于
      The ES58X devices has a CDC ACM interface (used for debug
      purpose). During probing, the device is thus recognized as USB Modem
      (CDC ACM), preventing the etas-es58x module to load:
        usbcore: registered new interface driver etas_es58x
        usb 1-1.1: new full-speed USB device number 14 using xhci_hcd
        usb 1-1.1: New USB device found, idVendor=108c, idProduct=0159, bcdDevice= 1.00
        usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
        usb 1-1.1: Product: ES581.4
        usb 1-1.1: Manufacturer: ETAS GmbH
        usb 1-1.1: SerialNumber: 2204355
        cdc_acm 1-1.1:1.0: No union descriptor, testing for castrated device
        cdc_acm 1-1.1:1.0: ttyACM0: USB ACM device
      
      Thus, these have been added to the ignore list in
      drivers/usb/class/cdc-acm.c
      
      N.B. Future firmware release of the ES58X will remove the CDC-ACM
      interface.
      
      `lsusb -v` of the three devices variant (ES581.4, ES582.1 and
      ES584.1):
      
        Bus 001 Device 011: ID 108c:0159 Robert Bosch GmbH ES581.4
        Device Descriptor:
          bLength                18
          bDescriptorType         1
          bcdUSB               1.10
          bDeviceClass            2 Communications
          bDeviceSubClass         0
          bDeviceProtocol         0
          bMaxPacketSize0        64
          idVendor           0x108c Robert Bosch GmbH
          idProduct          0x0159
          bcdDevice            1.00
          iManufacturer           1 ETAS GmbH
          iProduct                2 ES581.4
          iSerial                 3 2204355
          bNumConfigurations      1
          Configuration Descriptor:
            bLength                 9
            bDescriptorType         2
            wTotalLength       0x0035
            bNumInterfaces          1
            bConfigurationValue     1
            iConfiguration          5 Bus Powered Configuration
            bmAttributes         0x80
              (Bus Powered)
            MaxPower              100mA
            Interface Descriptor:
              bLength                 9
              bDescriptorType         4
              bInterfaceNumber        0
              bAlternateSetting       0
              bNumEndpoints           3
              bInterfaceClass         2 Communications
              bInterfaceSubClass      2 Abstract (modem)
              bInterfaceProtocol      0
              iInterface              4 ACM Control Interface
              CDC Header:
                bcdCDC               1.10
              CDC Call Management:
                bmCapabilities       0x01
                  call management
                bDataInterface          0
              CDC ACM:
                bmCapabilities       0x06
                  sends break
                  line coding and serial state
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x81  EP 1 IN
                bmAttributes            3
                  Transfer Type            Interrupt
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0010  1x 16 bytes
                bInterval              10
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x82  EP 2 IN
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0040  1x 64 bytes
                bInterval               0
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x03  EP 3 OUT
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0040  1x 64 bytes
                bInterval               0
        Device Status:     0x0000
          (Bus Powered)
      
        Bus 001 Device 012: ID 108c:0168 Robert Bosch GmbH ES582
        Device Descriptor:
          bLength                18
          bDescriptorType         1
          bcdUSB               2.00
          bDeviceClass            2 Communications
          bDeviceSubClass         0
          bDeviceProtocol         0
          bMaxPacketSize0        64
          idVendor           0x108c Robert Bosch GmbH
          idProduct          0x0168
          bcdDevice            1.00
          iManufacturer           1 ETAS GmbH
          iProduct                2 ES582
          iSerial                 3 0108933
          bNumConfigurations      1
          Configuration Descriptor:
            bLength                 9
            bDescriptorType         2
            wTotalLength       0x0043
            bNumInterfaces          2
            bConfigurationValue     1
            iConfiguration          0
            bmAttributes         0x80
              (Bus Powered)
            MaxPower              500mA
            Interface Descriptor:
              bLength                 9
              bDescriptorType         4
              bInterfaceNumber        0
              bAlternateSetting       0
              bNumEndpoints           1
              bInterfaceClass         2 Communications
              bInterfaceSubClass      2 Abstract (modem)
              bInterfaceProtocol      1 AT-commands (v.25ter)
              iInterface              0
              CDC Header:
                bcdCDC               1.10
              CDC ACM:
                bmCapabilities       0x02
                  line coding and serial state
              CDC Union:
                bMasterInterface        0
                bSlaveInterface         1
              CDC Call Management:
                bmCapabilities       0x03
                  call management
                  use DataInterface
                bDataInterface          1
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x83  EP 3 IN
                bmAttributes            3
                  Transfer Type            Interrupt
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0040  1x 64 bytes
                bInterval              16
            Interface Descriptor:
              bLength                 9
              bDescriptorType         4
              bInterfaceNumber        1
              bAlternateSetting       0
              bNumEndpoints           2
              bInterfaceClass        10 CDC Data
              bInterfaceSubClass      0
              bInterfaceProtocol      0
              iInterface              0
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x81  EP 1 IN
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0200  1x 512 bytes
                bInterval               0
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x02  EP 2 OUT
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0200  1x 512 bytes
                bInterval               0
        Device Qualifier (for other device speed):
          bLength                10
          bDescriptorType         6
          bcdUSB               2.00
          bDeviceClass            2 Communications
          bDeviceSubClass         0
          bDeviceProtocol         0
          bMaxPacketSize0        64
          bNumConfigurations      1
        Device Status:     0x0000
          (Bus Powered)
      
        Bus 001 Device 013: ID 108c:0169 Robert Bosch GmbH ES584.1
        Device Descriptor:
          bLength                18
          bDescriptorType         1
          bcdUSB               2.00
          bDeviceClass            2 Communications
          bDeviceSubClass         0
          bDeviceProtocol         0
          bMaxPacketSize0        64
          idVendor           0x108c Robert Bosch GmbH
          idProduct          0x0169
          bcdDevice            1.00
          iManufacturer           1 ETAS GmbH
          iProduct                2 ES584.1
          iSerial                 3 0100320
          bNumConfigurations      1
          Configuration Descriptor:
            bLength                 9
            bDescriptorType         2
            wTotalLength       0x0043
            bNumInterfaces          2
            bConfigurationValue     1
            iConfiguration          0
            bmAttributes         0x80
              (Bus Powered)
            MaxPower              500mA
            Interface Descriptor:
              bLength                 9
              bDescriptorType         4
              bInterfaceNumber        0
              bAlternateSetting       0
              bNumEndpoints           1
              bInterfaceClass         2 Communications
              bInterfaceSubClass      2 Abstract (modem)
              bInterfaceProtocol      1 AT-commands (v.25ter)
              iInterface              0
              CDC Header:
                bcdCDC               1.10
              CDC ACM:
                bmCapabilities       0x02
                  line coding and serial state
              CDC Union:
                bMasterInterface        0
                bSlaveInterface         1
              CDC Call Management:
                bmCapabilities       0x03
                  call management
                  use DataInterface
                bDataInterface          1
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x83  EP 3 IN
                bmAttributes            3
                  Transfer Type            Interrupt
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0040  1x 64 bytes
                bInterval              16
            Interface Descriptor:
              bLength                 9
              bDescriptorType         4
              bInterfaceNumber        1
              bAlternateSetting       0
              bNumEndpoints           2
              bInterfaceClass        10 CDC Data
              bInterfaceSubClass      0
              bInterfaceProtocol      0
              iInterface              0
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x81  EP 1 IN
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0200  1x 512 bytes
                bInterval               0
              Endpoint Descriptor:
                bLength                 7
                bDescriptorType         5
                bEndpointAddress     0x02  EP 2 OUT
                bmAttributes            2
                  Transfer Type            Bulk
                  Synch Type               None
                  Usage Type               Data
                wMaxPacketSize     0x0200  1x 512 bytes
                bInterval               0
        Device Qualifier (for other device speed):
          bLength                10
          bDescriptorType         6
          bcdUSB               2.00
          bDeviceClass            2 Communications
          bDeviceSubClass         0
          bDeviceProtocol         0
          bMaxPacketSize0        64
          bNumConfigurations      1
        Device Status:     0x0000
          (Bus Powered)
      Signed-off-by: NVincent Mailhol <mailhol.vincent@wanadoo.fr>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20201002154219.4887-8-mailhol.vincent@wanadoo.frSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a4f88430
  8. 25 9月, 2020 4 次提交
  9. 18 9月, 2020 1 次提交
  10. 18 8月, 2020 1 次提交
    • T
      USB: cdc-acm: rework notification_buffer resizing · f4b9d8a5
      Tom Rix 提交于
      Clang static analysis reports this error
      
      cdc-acm.c:409:3: warning: Use of memory after it is freed
              acm_process_notification(acm, (unsigned char *)dr);
      
      There are three problems, the first one is that dr is not reset
      
      The variable dr is set with
      
      if (acm->nb_index)
      	dr = (struct usb_cdc_notification *)acm->notification_buffer;
      
      But if the notification_buffer is too small it is resized with
      
      		if (acm->nb_size) {
      			kfree(acm->notification_buffer);
      			acm->nb_size = 0;
      		}
      		alloc_size = roundup_pow_of_two(expected_size);
      		/*
      		 * kmalloc ensures a valid notification_buffer after a
      		 * use of kfree in case the previous allocation was too
      		 * small. Final freeing is done on disconnect.
      		 */
      		acm->notification_buffer =
      			kmalloc(alloc_size, GFP_ATOMIC);
      
      dr should point to the new acm->notification_buffer.
      
      The second problem is any data in the notification_buffer is lost
      when the pointer is freed.  In the normal case, the current data
      is accumulated in the notification_buffer here.
      
      	memcpy(&acm->notification_buffer[acm->nb_index],
      	       urb->transfer_buffer, copy_size);
      
      When a resize happens, anything before
      notification_buffer[acm->nb_index] is garbage.
      
      The third problem is the acm->nb_index is not reset on a
      resizing buffer error.
      
      So switch resizing to using krealloc and reassign dr and
      reset nb_index.
      
      Fixes: ea258352 ("cdc-acm: reassemble fragmented notifications")
      Signed-off-by: NTom Rix <trix@redhat.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Link: https://lore.kernel.org/r/20200801152154.20683-1-trix@redhat.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f4b9d8a5
  11. 23 6月, 2020 1 次提交
  12. 18 6月, 2020 1 次提交
  13. 27 5月, 2020 1 次提交
  14. 16 4月, 2020 2 次提交
  15. 27 3月, 2020 1 次提交
  16. 18 3月, 2020 2 次提交
  17. 15 8月, 2019 1 次提交
  18. 29 4月, 2019 2 次提交
    • J
      USB: cdc-acm: clean up throttle handling · 0f02321e
      Johan Hovold 提交于
      Clean up the throttle implementation by dropping the redundant
      throttle_req flag which was a remnant from back when USB serial had only
      a single read URB, something which was later carried over to cdc-acm.
      
      Also convert the throttled flag to an atomic bit flag.
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0f02321e
    • J
      USB: cdc-acm: fix unthrottle races · 764478f4
      Johan Hovold 提交于
      Fix two long-standing bugs which could potentially lead to memory
      corruption or leave the port throttled until it is reopened (on weakly
      ordered systems), respectively, when read-URB completion races with
      unthrottle().
      
      First, the URB must not be marked as free before processing is complete
      to prevent it from being submitted by unthrottle() on another CPU.
      
      	CPU 1				CPU 2
      	================		================
      	complete()			unthrottle()
      	  process_urb();
      	  smp_mb__before_atomic();
      	  set_bit(i, free);		  if (test_and_clear_bit(i, free))
      						  submit_urb();
      
      Second, the URB must be marked as free before checking the throttled
      flag to prevent unthrottle() on another CPU from failing to observe that
      the URB needs to be submitted if complete() sees that the throttled flag
      is set.
      
      	CPU 1				CPU 2
      	================		================
      	complete()			unthrottle()
      	  set_bit(i, free);		  throttled = 0;
      	  smp_mb__after_atomic();	  smp_mb();
      	  if (throttled)		  if (test_and_clear_bit(i, free))
      		  return;			  submit_urb();
      
      Note that test_and_clear_bit() only implies barriers when the test is
      successful. To handle the case where the URB is still in use an explicit
      barrier needs to be added to unthrottle() for the second race condition.
      
      Also note that the first race was fixed by 36e59e0d ("cdc-acm: fix
      race between callback and unthrottle") back in 2015, but the bug was
      reintroduced a year later.
      
      Fixes: 1aba579f ("cdc-acm: handle read pipe errors")
      Fixes: 088c64f8 ("USB: cdc-acm: re-write read processing")
      Signed-off-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      764478f4
  19. 27 3月, 2019 1 次提交
    • R
      usb: cdc-acm: fix race during wakeup blocking TX traffic · 93e1c8a6
      Romain Izard 提交于
      When the kernel is compiled with preemption enabled, the URB completion
      handler can run in parallel with the work responsible for waking up the
      tty layer. If the URB handler sets the EVENT_TTY_WAKEUP bit during the
      call to tty_port_tty_wakeup() to signal that there is room for additional
      input, it will be cleared at the end of this call. As a result, TX traffic
      on the upper layer will be blocked.
      
      This can be seen with a kernel configured with CONFIG_PREEMPT, and a fast
      modem connected with PPP running over a USB CDC-ACM port.
      
      Use test_and_clear_bit() instead, which ensures that each wakeup requested
      by the URB completion code will trigger a call to tty_port_tty_wakeup().
      
      Fixes: 1aba579f cdc-acm: handle read pipe errors
      Signed-off-by: NRomain Izard <romain.izard.pro@gmail.com>
      Cc: stable <stable@vger.kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      93e1c8a6
  20. 08 1月, 2019 1 次提交
  21. 20 12月, 2018 1 次提交
    • M
      cdc-acm: fix abnormal DATA RX issue for Mediatek Preloader. · eafb27fa
      Macpaul Lin 提交于
      Mediatek Preloader is a proprietary embedded boot loader for loading
      Little Kernel and Linux into device DRAM.
      
      This boot loader also handle firmware update. Mediatek Preloader will be
      enumerated as a virtual COM port when the device is connected to Windows
      or Linux OS via CDC-ACM class driver. When the USB enumeration has been
      done, Mediatek Preloader will send out handshake command "READY" to PC
      actively instead of waiting command from the download tool.
      
      Since Linux 4.12, the commit "tty: reset termios state on device
      registration" (93857edd) causes Mediatek
      Preloader receiving some abnoraml command like "READYXX" as it sent.
      This will be recognized as an incorrect response. The behavior change
      also causes the download handshake fail. This change only affects
      subsequent connects if the reconnected device happens to get the same minor
      number.
      
      By disabling the ECHO termios flag could avoid this problem. However, it
      cannot be done by user space configuration when download tool open
      /dev/ttyACM0. This is because the device running Mediatek Preloader will
      send handshake command "READY" immediately once the CDC-ACM driver is
      ready.
      
      This patch wants to fix above problem by introducing "DISABLE_ECHO"
      property in driver_info. When Mediatek Preloader is connected, the
      CDC-ACM driver could disable ECHO flag in termios to avoid the problem.
      Signed-off-by: NMacpaul Lin <macpaul.lin@mediatek.com>
      Cc: stable@vger.kernel.org
      Reviewed-by: NJohan Hovold <johan@kernel.org>
      Acked-by: NOliver Neukum <oneukum@suse.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eafb27fa
  22. 20 11月, 2018 1 次提交
  23. 13 10月, 2018 1 次提交
  24. 09 10月, 2018 3 次提交
  25. 02 10月, 2018 1 次提交
  26. 11 9月, 2018 1 次提交
    • O
      Revert "cdc-acm: implement put_char() and flush_chars()" · df3aa13c
      Oliver Neukum 提交于
      This reverts commit a81cf979.
      
      The patch causes a regression, which I cannot find the reason for.
      So let's revert for now, as a revert hurts only performance.
      
      Original report:
      I was trying to resolve the problem with Oliver but we don't get any conclusion
      for 5 months, so I am now sending this to mail list and cdc_acm authors.
      
      I am using simple request-response protocol to obtain the boiller parameters
      in constant intervals.
      
      A simple one transaction is:
      1. opening the /dev/ttyACM0
      2. sending the following 10-bytes request to the device:
         unsigned char req[] = {0x02, 0xfe, 0x01, 0x05, 0x08, 0x02, 0x01, 0x69, 0xab, 0x03};
      3. reading response (frame of 74 bytes length).
      4. closing the descriptor
      I am doing this transaction with 5 seconds intervals.
      
      Before the bad commit everything was working correctly: I've got a requests and
      a responses in a timely manner.
      
      After the bad commit more time I am using the kernel module, more problems I have.
      The graph [2] is showing the problem.
      
      As you can see after module load all seems fine but after about 30 minutes I've got
      a plenty of EAGAINs when doing read()'s and trying to read back the data.
      
      When I rmmod and insmod the cdc_acm module again, then the situation is starting
      over again: running ok shortly after load, and more time it is running, more EAGAINs
      I have when calling read().
      
      As a bonus I can see the problem on the device itself:
      The device is configured as you can see here on this screen [3].
      It has two transmision LEDs: TX and RX. Blink duration is set for 100ms.
      This is a recording before the bad commit when all is working fine: [4]
      And this is with the bad commit: [5]
      As you can see the TX led is blinking wrongly long (indicating transmission?)
      and I have problems doing read() calls (EAGAIN).
      Reported-by: NMariusz Bialonczyk <manio@skyboo.net>
      Signed-off-by: NOliver Neukum <oneukum@suse.com>
      Fixes: a81cf979 ("cdc-acm: implement put_char() and flush_chars()")
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      df3aa13c
  27. 16 7月, 2018 1 次提交
  28. 28 6月, 2018 1 次提交