1. 05 8月, 2021 1 次提交
  2. 27 7月, 2021 4 次提交
  3. 21 7月, 2021 10 次提交
    • R
      usb: gadget: f_uac1: add volume and mute support · 0356e628
      Ruslan Bilovol 提交于
      This adds bi-directional (host->device, device->host)
      volume/mute support to the f_uac1 driver by adding
      Feature Units and interrupt endpoint.
      
      Currently only master channel is supported.
      
      Volume and mute are configurable through configfs,
      by default volume has -100..0 dB range with 1 dB step.
      
      Similar to existing flexible endpoints configuration,
      Feature Unit won't be added to the topology if both
      mute and volume are not enabled, also interrupt endpoint
      isn't added to the device if no feature unit is present
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NPavel Hofman <pavel.hofman@ivitera.com>
      Link: https://lore.kernel.org/r/20210712125529.76070-5-pavel.hofman@ivitera.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0356e628
    • R
      usb: gadget: f_uac2: add volume and mute support · eaf6cbe0
      Ruslan Bilovol 提交于
      This adds bi-directional (host->device, device->host)
      volume/mute support to the f_uac2 driver by adding
      Feature Units and interrupt endpoint.
      
      Currently only master channel is supported.
      
      Volume and mute are configurable through configfs,
      by default volume has -100..0 dB range with 1 dB step.
      
      Similar to existing flexible endpoints configuration,
      Feature Unit won't be added to the topology if both
      mute and volume are not enabled, also interrupt endpoint
      isn't added to the device if no feature unit is present
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NPavel Hofman <pavel.hofman@ivitera.com>
      Link: https://lore.kernel.org/r/20210712125529.76070-4-pavel.hofman@ivitera.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eaf6cbe0
    • R
      usb: gadget: u_audio: add bi-directional volume and mute support · 02de698c
      Ruslan Bilovol 提交于
      USB Audio Class 1/2 have ability to change device's
      volume and mute by USB Host through class-specific control
      requests. Device also can notify Host about volume/mute
      change on its side through optional interrupt endpoint.
      
      This patch adds Volume and Mute ALSA controls which can be
      used by user to send and receive notifications to/from
      the USB Host about Volume and Mute change.
      
      These params come from f_uac* so volume and mute controls
      will be created only if the function support and enable
      each explicitly
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NPavel Hofman <pavel.hofman@ivitera.com>
      Link: https://lore.kernel.org/r/20210712125529.76070-3-pavel.hofman@ivitera.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      02de698c
    • M
      usb: gadget: u_ether: fix a potential null pointer dereference · 8ae01239
      Maciej Żenczykowski 提交于
      f_ncm tx timeout can call us with null skb to flush
      a pending frame.  In this case skb is NULL to begin
      with but ceases to be null after dev->wrap() completes.
      
      In such a case in->maxpacket will be read, even though
      we've failed to check that 'in' is not NULL.
      
      Though I've never observed this fail in practice,
      however the 'flush operation' simply does not make sense with
      a null usb IN endpoint - there's nowhere to flush to...
      (note that we're the gadget/device, and IN is from the point
       of view of the host, so here IN actually means outbound...)
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-6-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      8ae01239
    • M
      usb: gadget: f_ncm: ncm_wrap_ntb - move var definitions into if statement · 6607d1a4
      Maciej Żenczykowski 提交于
      Since they're only used if there's an skb.
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-5-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      6607d1a4
    • M
      usb: gadget: f_ncm: remove spurious if statement · b88668fe
      Maciej Żenczykowski 提交于
      the current logic is:
      
        struct sk_buff  *skb2 = NULL;
        ...
      
        if (!skb && !ncm->skb_tx_data)
          return NULL;
      
        if (skb) {
          ...
        } else if (ncm->skb_tx_data)
          ...
        }
      
        return skb2;
      
      Which means that first if statement is simply not needed.
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-4-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b88668fe
    • M
      usb: gadget: f_ncm: remove check for NULL skb_tx_data in timer function · ec017d6b
      Maciej Żenczykowski 提交于
      This condition is already checked for in ncm_wrap_ntb(),
      except that that check is done with eth_dev->lock held
      (it is grabbed by eth_start_xmit).
      
      It's best to not be reaching into ncm struct without locks held.
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-3-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ec017d6b
    • M
      usb: gadget: f_ncm: remove spurious boolean timer_stopping · cf4e2e88
      Maciej Żenczykowski 提交于
      It is equivalent to ncm->netdev being NULL.
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-2-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf4e2e88
    • M
      usb: gadget: f_ncm: remove timer_force_tx field · dbaaca9a
      Maciej Żenczykowski 提交于
      It is simply not needed.  This field is equivalent to skb being NULL.
      
      Currently with the boolean set to true we call:
        ncm->netdev->netdev_ops->ndo_start_xmit(NULL, ncm->netdev);
      which calls u_ether's:
        eth_start_xmit(NULL, ...)
      which then calls:
        skb = dev->wrap(dev->port_usb, NULL);
      which calls back into f_ncm's:
        ncm_wrap_ntb(..., NULL)
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: "Bryan O'Donoghue" <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210701114834.884597-1-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      dbaaca9a
    • C
      usb: gadget: u_serial: remove WARN_ON on null port · 4bb233b7
      Colin Ian King 提交于
      Loading and then unloading module g_dpgp on a VM that does not
      support the driver currently throws a WARN_ON message because
      the port has not been initialized. Removing an unused driver
      is a valid use-case and the WARN_ON kernel warning is a bit
      excessive, so remove it.
      
      Cleans up:
      
      [27654.638698] ------------[ cut here ]------------
      [27654.638705] WARNING: CPU: 6 PID: 2956336 at drivers/usb/gadget/function/u_serial.c:1201 gserial_free_line+0x7c/0x90 [u_serial]
      [27654.638728] Modules linked in: g_dbgp(-) u_serial usb_f_tcm target_core_mod libcomposite udc_core vmw_vmci mcb i2c_nforce2 i2c_amd756 nfit cx8800 videobuf2_dma_sg videobuf2_memops videobuf2_v4l2 cx88xx tveeprom videobuf2_common videodev mc ccp hid_generic hid intel_ishtp cros_ec mc13xxx_core vfio_mdev mdev i915 i2c_algo_bit kvm ppdev parport zatm eni suni uPD98402 atm rio_scan binder_linux hwmon_vid video ipmi_devintf ipmi_msghandler zstd nls_utf8 decnet qrtr ns sctp ip6_udp_tunnel udp_tunnel fcrypt pcbc nhc_udp nhc_ipv6 nhc_routing nhc_mobility nhc_hop nhc_dest nhc_fragment 6lowpan ts_kmp dccp_ipv6 dccp_ipv4 dccp snd_seq_midi snd_seq_midi_event snd_rawmidi snd_seq_dummy snd_seq snd_seq_device xen_front_pgdir_shbuf binfmt_misc nls_iso8859_1 dm_multipath scsi_dh_rdac scsi_dh_emc scsi_dh_alua intel_rapl_msr intel_rapl_common snd_hda_codec_generic ledtrig_audio snd_hda_codec snd_hda_core snd_hwdep snd_pcm snd_timer snd rapl soundcore joydev input_leds mac_hid serio_raw efi_pstore
      [27654.638880]  qemu_fw_cfg sch_fq_codel msr virtio_rng autofs4 btrfs blake2b_generic zstd_compress raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq libcrc32c raid1 raid0 multipath linear qxl drm_ttm_helper crct10dif_pclmul ttm drm_kms_helper syscopyarea sysfillrect sysimgblt virtio_net fb_sys_fops cec net_failover rc_core ahci psmouse drm libahci lpc_ich virtio_blk failover [last unloaded: u_ether]
      [27654.638949] CPU: 6 PID: 2956336 Comm: modprobe Tainted: P           O      5.13.0-9-generic #9
      [27654.638956] Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015
      [27654.638969] RIP: 0010:gserial_free_line+0x7c/0x90 [u_serial]
      [27654.638981] Code: 20 00 00 00 00 e8 74 1a ba c9 4c 89 e7 e8 8c fe ff ff 48 8b 3d 75 3b 00 00 44 89 f6 e8 3d 7c 69 c9 5b 41 5c 41 5d 41 5e 5d c3 <0f> 0b 4c 89 ef e8 4a 1a ba c9 5b 41 5c 41 5d 41 5e 5d c3 90 0f 1f
      [27654.638986] RSP: 0018:ffffba0b81403da0 EFLAGS: 00010246
      [27654.638992] RAX: 0000000000000000 RBX: ffffffffc0eaf6a0 RCX: 0000000000000000
      [27654.638996] RDX: ffff8e21c0cac8c0 RSI: 0000000000000006 RDI: ffffffffc0eaf6a0
      [27654.639000] RBP: ffffba0b81403dc0 R08: ffffba0b81403de0 R09: fefefefefefefeff
      [27654.639003] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
      [27654.639006] R13: ffffffffc0eaf6a0 R14: 0000000000000000 R15: 0000000000000000
      [27654.639010] FS:  00007faa1935e740(0000) GS:ffff8e223bd80000(0000) knlGS:0000000000000000
      [27654.639015] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [27654.639019] CR2: 00007ffc840cd4e8 CR3: 000000000e1ac006 CR4: 0000000000370ee0
      [27654.639028] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
      [27654.639031] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
      [27654.639035] Call Trace:
      [27654.639044]  dbgp_exit+0x1c/0xa1a [g_dbgp]
      [27654.639054]  __do_sys_delete_module.constprop.0+0x144/0x260
      [27654.639066]  ? call_rcu+0xe/0x10
      [27654.639073]  __x64_sys_delete_module+0x12/0x20
      [27654.639081]  do_syscall_64+0x61/0xb0
      [27654.639092]  ? exit_to_user_mode_loop+0xec/0x160
      [27654.639098]  ? exit_to_user_mode_prepare+0x37/0xb0
      [27654.639104]  ? syscall_exit_to_user_mode+0x27/0x50
      [27654.639110]  ? __x64_sys_close+0x12/0x40
      [27654.639119]  ? do_syscall_64+0x6e/0xb0
      [27654.639126]  ? exit_to_user_mode_prepare+0x37/0xb0
      [27654.639132]  ? syscall_exit_to_user_mode+0x27/0x50
      [27654.639137]  ? __x64_sys_newfstatat+0x1e/0x20
      [27654.639146]  ? do_syscall_64+0x6e/0xb0
      [27654.639154]  ? exc_page_fault+0x8f/0x170
      [27654.639159]  ? asm_exc_page_fault+0x8/0x30
      [27654.639166]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      [27654.639173] RIP: 0033:0x7faa194a4b2b
      [27654.639179] Code: 73 01 c3 48 8b 0d 3d 73 0c 00 f7 d8 64 89 01 48 83 c8 ff c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa b8 b0 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 0d 73 0c 00 f7 d8 64 89 01 48
      [27654.639185] RSP: 002b:00007ffc840d0578 EFLAGS: 00000206 ORIG_RAX: 00000000000000b0
      [27654.639191] RAX: ffffffffffffffda RBX: 000056060f9f4e70 RCX: 00007faa194a4b2b
      [27654.639194] RDX: 0000000000000000 RSI: 0000000000000800 RDI: 000056060f9f4ed8
      [27654.639197] RBP: 000056060f9f4e70 R08: 0000000000000000 R09: 0000000000000000
      [27654.639200] R10: 00007faa1951eac0 R11: 0000000000000206 R12: 000056060f9f4ed8
      [27654.639203] R13: 0000000000000000 R14: 000056060f9f4ed8 R15: 00007ffc840d06c8
      [27654.639219] ---[ end trace 8dd0ea0bb32ce94a ]---
      Signed-off-by: NColin Ian King <colin.king@canonical.com>
      Link: https://lore.kernel.org/r/20210701144305.110078-1-colin.king@canonical.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4bb233b7
  4. 21 6月, 2021 2 次提交
  5. 09 6月, 2021 9 次提交
    • R
      usb: gadget: u_audio: add real feedback implementation · e89bb428
      Ruslan Bilovol 提交于
      This adds interface between userspace and feedback endpoint to report real
      feedback frequency to the Host.
      
      Current implementation adds new userspace interface ALSA mixer control
      "Capture Pitch 1000000" (similar to aloop driver's "PCM Rate Shift 100000"
      mixer control)
      
      Value in PPM is chosen to have correction value agnostic of the actual HW
      rate, which the application is not necessarily dealing with, while still
      retaining a good enough precision to allow smooth clock correction on the
      playback side, if necessary.
      
      Similar to sound/usb/endpoint.c, a slow down is allowed up to 25%. This
      has no impact on the required bandwidth. Speedup correction has an impact
      on the bandwidth reserved for the isochronous endpoint. The default
      allowed speedup is 500ppm. This seems to be more than enough but, if
      necessary, this is configurable through a module parameter. The reserved
      bandwidth is rounded up to the next packet size.
      
      Usage of this new control is easy to implement in existing userspace tools
      like alsaloop from alsa-utils.
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20210603220104.1216001-4-jbrunet@baylibre.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e89bb428
    • R
      usb: gadget: f_uac2: add adaptive sync support for capture · 40c73b30
      Ruslan Bilovol 提交于
      Current f_uac2 USB OUT (aka 'capture') synchronization
      implements 'ASYNC' scenario which means USB Gadget has
      it's own freerunning clock and can update Host about
      real clock frequency through feedback endpoint so Host
      can align number of samples sent to the USB gadget to
      prevent overruns/underruns
      
      In case if Gadget can has no it's internal clock and
      can consume audio samples at any rate (for example,
      on the Gadget side someone records audio directly to
      a file, or audio samples are played through an
      external DAC as soon as they arrive), UAC2 spec
      suggests 'ADAPTIVE' synchronization type.
      
      Change UAC2 driver to make it configurable through
      additional 'c_sync' configfs file.
      
      Default remains 'asynchronous' with possibility to
      switch it to 'adaptive'
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20210603220104.1216001-3-jbrunet@baylibre.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      40c73b30
    • R
      usb: gadget: f_uac2/u_audio: add feedback endpoint support · 24f779da
      Ruslan Bilovol 提交于
      As per USB and UAC2 specs, asynchronous audio sink endpoint
      requires explicit synchronization mechanism (Isochronous
      Feedback Endpoint)
      
      Implement feedback companion endpoint for ISO OUT endpoint
      
      This patch adds all required infrastructure and USB requests
      handling for feedback endpoint. Syncrhonization itself is
      still dummy (feedback ep always reports 'nomimal frequency'
       e.g. no adjustement is needed). This satisfies hosts that
      require feedback endpoint (like Win10) and poll it periodically
      
      Actual synchronization mechanism should be implemented
      separately
      Signed-off-by: NRuslan Bilovol <ruslan.bilovol@gmail.com>
      Signed-off-by: NJerome Brunet <jbrunet@baylibre.com>
      Link: https://lore.kernel.org/r/20210603220104.1216001-2-jbrunet@baylibre.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      24f779da
    • A
      usb: gadget: f_fs: Fix setting of device and driver data cross-references · ecfbd7b9
      Andrew Gabbasov 提交于
      FunctionFS device structure 'struct ffs_dev' and driver data structure
      'struct ffs_data' are bound to each other with cross-reference pointers
      'ffs_data->private_data' and 'ffs_dev->ffs_data'. While the first one
      is supposed to be valid through the whole life of 'struct ffs_data'
      (and while 'struct ffs_dev' exists non-freed), the second one is cleared
      in 'ffs_closed()' (called from 'ffs_data_reset()' or the last
      'ffs_data_put()'). This can be called several times, alternating in
      different order with 'ffs_free_inst()', that, if possible, clears
      the other cross-reference.
      
      As a result, different cases of these calls order may leave stale
      cross-reference pointers, used when the pointed structure is already
      freed. Even if it occasionally doesn't cause kernel crash, this error
      is reported by KASAN-enabled kernel configuration.
      
      For example, the case [last 'ffs_data_put()' - 'ffs_free_inst()'] was
      fixed by commit cdafb6d8 ("usb: gadget: f_fs: Fix use-after-free in
      ffs_free_inst").
      
      The other case ['ffs_data_reset()' - 'ffs_free_inst()' - 'ffs_data_put()']
      now causes KASAN reported error [1], when 'ffs_data_reset()' clears
      'ffs_dev->ffs_data', then 'ffs_free_inst()' frees the 'struct ffs_dev',
      but can't clear 'ffs_data->private_data', which is then accessed
      in 'ffs_closed()' called from 'ffs_data_put()'. This happens since
      'ffs_dev->ffs_data' reference is cleared too early.
      
      Moreover, one more use case, when 'ffs_free_inst()' is called immediately
      after mounting FunctionFS device (that is before the descriptors are
      written and 'ffs_ready()' is called), and then 'ffs_data_reset()'
      or 'ffs_data_put()' is called from accessing "ep0" file or unmounting
      the device. This causes KASAN error report like [2], since
      'ffs_dev->ffs_data' is not yet set when 'ffs_free_inst()' can't properly
      clear 'ffs_data->private_data', that is later accessed to freed structure.
      
      Fix these (and may be other) cases of stale pointers access by moving
      setting and clearing of the mentioned cross-references to the single
      places, setting both of them when 'struct ffs_data' is created and
      bound to 'struct ffs_dev', and clearing both of them when one of the
      structures is destroyed. It seems convenient to make this pointer
      initialization and structures binding in 'ffs_acquire_dev()' and
      make pointers clearing in 'ffs_release_dev()'. This required some
      changes in these functions parameters and return types.
      
      Also, 'ffs_release_dev()' calling requires some cleanup, fixing minor
      issues, like (1) 'ffs_release_dev()' is not called if 'ffs_free_inst()'
      is called without unmounting the device, and "release_dev" callback
      is not called at all, or (2) "release_dev" callback is called before
      "ffs_closed" callback on unmounting, which seems to be not correctly
      nested with "acquire_dev" and "ffs_ready" callbacks.
      Make this cleanup togther with other mentioned 'ffs_release_dev()' changes.
      
      [1]
      ==================================================================
      root@rcar-gen3:~# mkdir /dev/cfs
      root@rcar-gen3:~# mkdir /dev/ffs
      root@rcar-gen3:~# modprobe libcomposite
      root@rcar-gen3:~# mount -t configfs none /dev/cfs
      root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1
      root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs
      [   64.340664] file system registered
      root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs
      root@rcar-gen3:~# cd /dev/ffs
      root@rcar-gen3:/dev/ffs# /home/root/ffs-test
      ffs-test: info: ep0: writing descriptors (in v2 format)
      [   83.181442] read descriptors
      [   83.186085] read strings
      ffs-test: info: ep0: writing strings
      ffs-test: dbg:  ep1: starting
      ffs-test: dbg:  ep2: starting
      ffs-test: info: ep1: starts
      ffs-test: info: ep2: starts
      ffs-test: info: ep0: starts
      
      ^C
      root@rcar-gen3:/dev/ffs# cd /home/root/
      root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs
      [   98.935061] unloading
      root@rcar-gen3:~# umount /dev/ffs
      [  102.734301] ==================================================================
      [  102.742059] BUG: KASAN: use-after-free in ffs_release_dev+0x64/0xa8 [usb_f_fs]
      [  102.749683] Write of size 1 at addr ffff0004d46ff549 by task umount/2997
      [  102.756709]
      [  102.758311] CPU: 0 PID: 2997 Comm: umount Not tainted 5.13.0-rc4+ #8
      [  102.764971] Hardware name: Renesas Salvator-X board based on r8a77951 (DT)
      [  102.772179] Call trace:
      [  102.774779]  dump_backtrace+0x0/0x330
      [  102.778653]  show_stack+0x20/0x2c
      [  102.782152]  dump_stack+0x11c/0x1ac
      [  102.785833]  print_address_description.constprop.0+0x30/0x274
      [  102.791862]  kasan_report+0x14c/0x1c8
      [  102.795719]  __asan_report_store1_noabort+0x34/0x58
      [  102.800840]  ffs_release_dev+0x64/0xa8 [usb_f_fs]
      [  102.805801]  ffs_fs_kill_sb+0x50/0x84 [usb_f_fs]
      [  102.810663]  deactivate_locked_super+0xa0/0xf0
      [  102.815339]  deactivate_super+0x98/0xac
      [  102.819378]  cleanup_mnt+0xd0/0x1b0
      [  102.823057]  __cleanup_mnt+0x1c/0x28
      [  102.826823]  task_work_run+0x104/0x180
      [  102.830774]  do_notify_resume+0x458/0x14e0
      [  102.835083]  work_pending+0xc/0x5f8
      [  102.838762]
      [  102.840357] Allocated by task 2988:
      [  102.844032]  kasan_save_stack+0x28/0x58
      [  102.848071]  kasan_set_track+0x28/0x3c
      [  102.852016]  ____kasan_kmalloc+0x84/0x9c
      [  102.856142]  __kasan_kmalloc+0x10/0x1c
      [  102.860088]  __kmalloc+0x214/0x2f8
      [  102.863678]  kzalloc.constprop.0+0x14/0x20 [usb_f_fs]
      [  102.868990]  ffs_alloc_inst+0x8c/0x208 [usb_f_fs]
      [  102.873942]  try_get_usb_function_instance+0xf0/0x164 [libcomposite]
      [  102.880629]  usb_get_function_instance+0x64/0x68 [libcomposite]
      [  102.886858]  function_make+0x128/0x1ec [libcomposite]
      [  102.892185]  configfs_mkdir+0x330/0x590 [configfs]
      [  102.897245]  vfs_mkdir+0x12c/0x1bc
      [  102.900835]  do_mkdirat+0x180/0x1d0
      [  102.904513]  __arm64_sys_mkdirat+0x80/0x94
      [  102.908822]  invoke_syscall+0xf8/0x25c
      [  102.912772]  el0_svc_common.constprop.0+0x150/0x1a0
      [  102.917891]  do_el0_svc+0xa0/0xd4
      [  102.921386]  el0_svc+0x24/0x34
      [  102.924613]  el0_sync_handler+0xcc/0x154
      [  102.928743]  el0_sync+0x198/0x1c0
      [  102.932238]
      [  102.933832] Freed by task 2996:
      [  102.937144]  kasan_save_stack+0x28/0x58
      [  102.941181]  kasan_set_track+0x28/0x3c
      [  102.945128]  kasan_set_free_info+0x28/0x4c
      [  102.949435]  ____kasan_slab_free+0x104/0x118
      [  102.953921]  __kasan_slab_free+0x18/0x24
      [  102.958047]  slab_free_freelist_hook+0x148/0x1f0
      [  102.962897]  kfree+0x318/0x440
      [  102.966123]  ffs_free_inst+0x164/0x2d8 [usb_f_fs]
      [  102.971075]  usb_put_function_instance+0x84/0xa4 [libcomposite]
      [  102.977302]  ffs_attr_release+0x18/0x24 [usb_f_fs]
      [  102.982344]  config_item_put+0x140/0x1a4 [configfs]
      [  102.987486]  configfs_rmdir+0x3fc/0x518 [configfs]
      [  102.992535]  vfs_rmdir+0x114/0x234
      [  102.996122]  do_rmdir+0x274/0x2b0
      [  102.999617]  __arm64_sys_unlinkat+0x94/0xc8
      [  103.004015]  invoke_syscall+0xf8/0x25c
      [  103.007961]  el0_svc_common.constprop.0+0x150/0x1a0
      [  103.013080]  do_el0_svc+0xa0/0xd4
      [  103.016575]  el0_svc+0x24/0x34
      [  103.019801]  el0_sync_handler+0xcc/0x154
      [  103.023930]  el0_sync+0x198/0x1c0
      [  103.027426]
      [  103.029020] The buggy address belongs to the object at ffff0004d46ff500
      [  103.029020]  which belongs to the cache kmalloc-128 of size 128
      [  103.042079] The buggy address is located 73 bytes inside of
      [  103.042079]  128-byte region [ffff0004d46ff500, ffff0004d46ff580)
      [  103.054236] The buggy address belongs to the page:
      [  103.059262] page:0000000021aa849b refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0004d46fee00 pfn:0x5146fe
      [  103.070437] head:0000000021aa849b order:1 compound_mapcount:0
      [  103.076456] flags: 0x8000000000010200(slab|head|zone=2)
      [  103.081948] raw: 8000000000010200 fffffc0013521a80 0000000d0000000d ffff0004c0002300
      [  103.090052] raw: ffff0004d46fee00 000000008020001e 00000001ffffffff 0000000000000000
      [  103.098150] page dumped because: kasan: bad access detected
      [  103.103985]
      [  103.105578] Memory state around the buggy address:
      [  103.110602]  ffff0004d46ff400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  103.118161]  ffff0004d46ff480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  103.125726] >ffff0004d46ff500: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  103.133284]                                               ^
      [  103.139120]  ffff0004d46ff580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [  103.146679]  ffff0004d46ff600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [  103.154238] ==================================================================
      [  103.161792] Disabling lock debugging due to kernel taint
      [  103.167319] Unable to handle kernel paging request at virtual address 0037801d6000018e
      [  103.175406] Mem abort info:
      [  103.178457]   ESR = 0x96000004
      [  103.181609]   EC = 0x25: DABT (current EL), IL = 32 bits
      [  103.187020]   SET = 0, FnV = 0
      [  103.190185]   EA = 0, S1PTW = 0
      [  103.193417] Data abort info:
      [  103.196385]   ISV = 0, ISS = 0x00000004
      [  103.200315]   CM = 0, WnR = 0
      [  103.203366] [0037801d6000018e] address between user and kernel address ranges
      [  103.210611] Internal error: Oops: 96000004 [#1] PREEMPT SMP
      [  103.216231] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk sata_rc4
      [  103.259233] CPU: 0 PID: 2997 Comm: umount Tainted: G    B             5.13.0-rc4+ #8
      [  103.267031] Hardware name: Renesas Salvator-X board based on r8a77951 (DT)
      [  103.273951] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--)
      [  103.280001] pc : ffs_data_clear+0x138/0x370 [usb_f_fs]
      [  103.285197] lr : ffs_data_clear+0x124/0x370 [usb_f_fs]
      [  103.290385] sp : ffff800014777a80
      [  103.293725] x29: ffff800014777a80 x28: ffff0004d7649c80 x27: 0000000000000000
      [  103.300931] x26: ffff800014777fb0 x25: ffff60009aec9394 x24: ffff0004d7649ca4
      [  103.308136] x23: 1fffe0009a3d063a x22: dfff800000000000 x21: ffff0004d1e831d0
      [  103.315340] x20: e1c000eb00000bb4 x19: ffff0004d1e83000 x18: 0000000000000000
      [  103.322545] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
      [  103.329748] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000012ef658
      [  103.336952] x11: ffff7000012ef658 x10: 0720072007200720 x9 : ffff800011322648
      [  103.344157] x8 : ffff800014777818 x7 : ffff80000977b2c7 x6 : 0000000000000000
      [  103.351359] x5 : 0000000000000001 x4 : ffff7000012ef659 x3 : 0000000000000001
      [  103.358562] x2 : 0000000000000000 x1 : 1c38001d6000018e x0 : e1c000eb00000c70
      [  103.365766] Call trace:
      [  103.368235]  ffs_data_clear+0x138/0x370 [usb_f_fs]
      [  103.373076]  ffs_data_reset+0x20/0x304 [usb_f_fs]
      [  103.377829]  ffs_data_closed+0x1ec/0x244 [usb_f_fs]
      [  103.382755]  ffs_fs_kill_sb+0x70/0x84 [usb_f_fs]
      [  103.387420]  deactivate_locked_super+0xa0/0xf0
      [  103.391905]  deactivate_super+0x98/0xac
      [  103.395776]  cleanup_mnt+0xd0/0x1b0
      [  103.399299]  __cleanup_mnt+0x1c/0x28
      [  103.402906]  task_work_run+0x104/0x180
      [  103.406691]  do_notify_resume+0x458/0x14e0
      [  103.410823]  work_pending+0xc/0x5f8
      [  103.414351] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821)
      [  103.420490] ---[ end trace 57b43a50e8244f57 ]---
      Segmentation fault
      root@rcar-gen3:~#
      ==================================================================
      
      [2]
      ==================================================================
      root@rcar-gen3:~# mkdir /dev/ffs
      root@rcar-gen3:~# modprobe libcomposite
      root@rcar-gen3:~#
      root@rcar-gen3:~# mount -t configfs none /dev/cfs
      root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1
      root@rcar-gen3:~# mkdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs
      [   54.766480] file system registered
      root@rcar-gen3:~# mount -t functionfs ffs /dev/ffs
      root@rcar-gen3:~# rmdir /dev/cfs/usb_gadget/g1/functions/ffs.ffs
      [   63.197597] unloading
      root@rcar-gen3:~# cat /dev/ffs/ep0
      cat: read error:[   67.213506] ==================================================================
      [   67.222095] BUG: KASAN: use-after-free in ffs_data_clear+0x70/0x370 [usb_f_fs]
      [   67.229699] Write of size 1 at addr ffff0004c26e974a by task cat/2994
      [   67.236446]
      [   67.238045] CPU: 0 PID: 2994 Comm: cat Not tainted 5.13.0-rc4+ #8
      [   67.244431] Hardware name: Renesas Salvator-X board based on r8a77951 (DT)
      [   67.251624] Call trace:
      [   67.254212]  dump_backtrace+0x0/0x330
      [   67.258081]  show_stack+0x20/0x2c
      [   67.261579]  dump_stack+0x11c/0x1ac
      [   67.265260]  print_address_description.constprop.0+0x30/0x274
      [   67.271286]  kasan_report+0x14c/0x1c8
      [   67.275143]  __asan_report_store1_noabort+0x34/0x58
      [   67.280265]  ffs_data_clear+0x70/0x370 [usb_f_fs]
      [   67.285220]  ffs_data_reset+0x20/0x304 [usb_f_fs]
      [   67.290172]  ffs_data_closed+0x240/0x244 [usb_f_fs]
      [   67.295305]  ffs_ep0_release+0x40/0x54 [usb_f_fs]
      [   67.300256]  __fput+0x304/0x580
      [   67.303576]  ____fput+0x18/0x24
      [   67.306893]  task_work_run+0x104/0x180
      [   67.310846]  do_notify_resume+0x458/0x14e0
      [   67.315154]  work_pending+0xc/0x5f8
      [   67.318834]
      [   67.320429] Allocated by task 2988:
      [   67.324105]  kasan_save_stack+0x28/0x58
      [   67.328144]  kasan_set_track+0x28/0x3c
      [   67.332090]  ____kasan_kmalloc+0x84/0x9c
      [   67.336217]  __kasan_kmalloc+0x10/0x1c
      [   67.340163]  __kmalloc+0x214/0x2f8
      [   67.343754]  kzalloc.constprop.0+0x14/0x20 [usb_f_fs]
      [   67.349066]  ffs_alloc_inst+0x8c/0x208 [usb_f_fs]
      [   67.354017]  try_get_usb_function_instance+0xf0/0x164 [libcomposite]
      [   67.360705]  usb_get_function_instance+0x64/0x68 [libcomposite]
      [   67.366934]  function_make+0x128/0x1ec [libcomposite]
      [   67.372260]  configfs_mkdir+0x330/0x590 [configfs]
      [   67.377320]  vfs_mkdir+0x12c/0x1bc
      [   67.380911]  do_mkdirat+0x180/0x1d0
      [   67.384589]  __arm64_sys_mkdirat+0x80/0x94
      [   67.388899]  invoke_syscall+0xf8/0x25c
      [   67.392850]  el0_svc_common.constprop.0+0x150/0x1a0
      [   67.397969]  do_el0_svc+0xa0/0xd4
      [   67.401464]  el0_svc+0x24/0x34
      [   67.404691]  el0_sync_handler+0xcc/0x154
      [   67.408819]  el0_sync+0x198/0x1c0
      [   67.412315]
      [   67.413909] Freed by task 2993:
      [   67.417220]  kasan_save_stack+0x28/0x58
      [   67.421257]  kasan_set_track+0x28/0x3c
      [   67.425204]  kasan_set_free_info+0x28/0x4c
      [   67.429513]  ____kasan_slab_free+0x104/0x118
      [   67.434001]  __kasan_slab_free+0x18/0x24
      [   67.438128]  slab_free_freelist_hook+0x148/0x1f0
      [   67.442978]  kfree+0x318/0x440
      [   67.446205]  ffs_free_inst+0x164/0x2d8 [usb_f_fs]
      [   67.451156]  usb_put_function_instance+0x84/0xa4 [libcomposite]
      [   67.457385]  ffs_attr_release+0x18/0x24 [usb_f_fs]
      [   67.462428]  config_item_put+0x140/0x1a4 [configfs]
      [   67.467570]  configfs_rmdir+0x3fc/0x518 [configfs]
      [   67.472626]  vfs_rmdir+0x114/0x234
      [   67.476215]  do_rmdir+0x274/0x2b0
      [   67.479710]  __arm64_sys_unlinkat+0x94/0xc8
      [   67.484108]  invoke_syscall+0xf8/0x25c
      [   67.488055]  el0_svc_common.constprop.0+0x150/0x1a0
      [   67.493175]  do_el0_svc+0xa0/0xd4
      [   67.496671]  el0_svc+0x24/0x34
      [   67.499896]  el0_sync_handler+0xcc/0x154
      [   67.504024]  el0_sync+0x198/0x1c0
      [   67.507520]
      [   67.509114] The buggy address belongs to the object at ffff0004c26e9700
      [   67.509114]  which belongs to the cache kmalloc-128 of size 128
      [   67.522171] The buggy address is located 74 bytes inside of
      [   67.522171]  128-byte region [ffff0004c26e9700, ffff0004c26e9780)
      [   67.534328] The buggy address belongs to the page:
      [   67.539355] page:000000003177a217 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x5026e8
      [   67.549175] head:000000003177a217 order:1 compound_mapcount:0
      [   67.555195] flags: 0x8000000000010200(slab|head|zone=2)
      [   67.560687] raw: 8000000000010200 fffffc0013037100 0000000c00000002 ffff0004c0002300
      [   67.568791] raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000
      [   67.576890] page dumped because: kasan: bad access detected
      [   67.582725]
      [   67.584318] Memory state around the buggy address:
      [   67.589343]  ffff0004c26e9600: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   67.596903]  ffff0004c26e9680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   67.604463] >ffff0004c26e9700: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
      [   67.612022]                                               ^
      [   67.617860]  ffff0004c26e9780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
      [   67.625421]  ffff0004c26e9800: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
      [   67.632981] ==================================================================
      [   67.640535] Disabling lock debugging due to kernel taint
       File descriptor[   67.646100] Unable to handle kernel paging request at virtual address fabb801d4000018d
       in bad state
      [   67.655456] Mem abort info:
      [   67.659619]   ESR = 0x96000004
      [   67.662801]   EC = 0x25: DABT (current EL), IL = 32 bits
      [   67.668225]   SET = 0, FnV = 0
      [   67.671375]   EA = 0, S1PTW = 0
      [   67.674613] Data abort info:
      [   67.677587]   ISV = 0, ISS = 0x00000004
      [   67.681522]   CM = 0, WnR = 0
      [   67.684588] [fabb801d4000018d] address between user and kernel address ranges
      [   67.691849] Internal error: Oops: 96000004 [#1] PREEMPT SMP
      [   67.697470] Modules linked in: usb_f_fs libcomposite configfs ath9k_htc led_class mac80211 libarc4 ath9k_common ath9k_hw ath cfg80211 aes_ce_blk crypto_simd cryptd aes_ce_cipher ghash_ce gf128mul sha2_ce sha1_ce evdev sata_rcar libata xhci_plat_hcd scsi_mod xhci_hcd rene4
      [   67.740467] CPU: 0 PID: 2994 Comm: cat Tainted: G    B             5.13.0-rc4+ #8
      [   67.748005] Hardware name: Renesas Salvator-X board based on r8a77951 (DT)
      [   67.754924] pstate: 00000005 (nzcv daif -PAN -UAO -TCO BTYPE=--)
      [   67.760974] pc : ffs_data_clear+0x138/0x370 [usb_f_fs]
      [   67.766178] lr : ffs_data_clear+0x124/0x370 [usb_f_fs]
      [   67.771365] sp : ffff800014767ad0
      [   67.774706] x29: ffff800014767ad0 x28: ffff800009cf91c0 x27: ffff0004c54861a0
      [   67.781913] x26: ffff0004dc90b288 x25: 1fffe00099ec10f5 x24: 00000000000a801d
      [   67.789118] x23: 1fffe00099f6953a x22: dfff800000000000 x21: ffff0004cfb4a9d0
      [   67.796322] x20: d5e000ea00000bb1 x19: ffff0004cfb4a800 x18: 0000000000000000
      [   67.803526] x17: 0000000000000000 x16: 0000000000000000 x15: 0000000000000000
      [   67.810730] x14: 0720072007200720 x13: 0720072007200720 x12: 1ffff000028ecefa
      [   67.817934] x11: ffff7000028ecefa x10: 0720072007200720 x9 : ffff80001132c014
      [   67.825137] x8 : ffff8000147677d8 x7 : ffff8000147677d7 x6 : 0000000000000000
      [   67.832341] x5 : 0000000000000001 x4 : ffff7000028ecefb x3 : 0000000000000001
      [   67.839544] x2 : 0000000000000005 x1 : 1abc001d4000018d x0 : d5e000ea00000c6d
      [   67.846748] Call trace:
      [   67.849218]  ffs_data_clear+0x138/0x370 [usb_f_fs]
      [   67.854058]  ffs_data_reset+0x20/0x304 [usb_f_fs]
      [   67.858810]  ffs_data_closed+0x240/0x244 [usb_f_fs]
      [   67.863736]  ffs_ep0_release+0x40/0x54 [usb_f_fs]
      [   67.868488]  __fput+0x304/0x580
      [   67.871665]  ____fput+0x18/0x24
      [   67.874837]  task_work_run+0x104/0x180
      [   67.878622]  do_notify_resume+0x458/0x14e0
      [   67.882754]  work_pending+0xc/0x5f8
      [   67.886282] Code: b4000a54 9102f280 12000802 d343fc01 (38f66821)
      [   67.892422] ---[ end trace 6d7cedf53d7abbea ]---
      Segmentation fault
      root@rcar-gen3:~#
      ==================================================================
      
      Fixes: 4b187fce ("usb: gadget: FunctionFS: add devices management code")
      Fixes: 3262ad82 ("usb: gadget: f_fs: Stop ffs_closed NULL pointer dereference")
      Fixes: cdafb6d8 ("usb: gadget: f_fs: Fix use-after-free in ffs_free_inst")
      Reported-by: NBhuvanesh Surachari <bhuvanesh_surachari@mentor.com>
      Tested-by: NEugeniu Rosca <erosca@de.adit-jv.com>
      Reviewed-by: NEugeniu Rosca <erosca@de.adit-jv.com>
      Signed-off-by: NAndrew Gabbasov <andrew_gabbasov@mentor.com>
      Link: https://lore.kernel.org/r/20210603171507.22514-1-andrew_gabbasov@mentor.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ecfbd7b9
    • B
    • L
      usb: gadget: eem: fix wrong eem header operation · 305f6708
      Linyu Yuan 提交于
      when skb_clone() or skb_copy_expand() fail,
      it should pull skb with lengh indicated by header,
      or not it will read network data and check it as header.
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NLinyu Yuan <linyyuan@codeaurora.com>
      Link: https://lore.kernel.org/r/20210608233547.3767-1-linyyuan@codeaurora.orgSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      305f6708
    • M
      usb: fix various gadgets null ptr deref on 10gbps cabling. · 90c4d057
      Maciej Żenczykowski 提交于
      This avoids a null pointer dereference in
      f_{ecm,eem,hid,loopback,printer,rndis,serial,sourcesink,subset,tcm}
      by simply reusing the 5gbps config for 10gbps.
      
      Fixes: eaef50c7 ("usb: gadget: Update usb_assign_descriptors for SuperSpeedPlus")
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Michael R Sweet <msweet@msweet.org>
      Cc: Mike Christie <michael.christie@oracle.com>
      Cc: Pawel Laszczak <pawell@cadence.com>
      Cc: Peter Chen <peter.chen@nxp.com>
      Cc: Sudhakar Panneerselvam <sudhakar.panneerselvam@oracle.com>
      Cc: Wei Ming Chen <jj251510319013@gmail.com>
      Cc: Will McVicker <willmcvicker@google.com>
      Cc: Zqiang <qiang.zhang@windriver.com>
      Reviewed-By: NLorenzo Colitti <lorenzo@google.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210608044141.3898496-1-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      90c4d057
    • M
      usb: f_ncm: only first packet of aggregate needs to start timer · 1958ff5a
      Maciej Żenczykowski 提交于
      The reasoning for this change is that if we already had
      a packet pending, then we also already had a pending timer,
      and as such there is no need to reschedule it.
      
      This also prevents packets getting delayed 60 ms worst case
      under a tiny packet every 290us transmit load, by keeping the
      timeout always relative to the first queued up packet.
      (300us delay * 16KB max aggregation / 80 byte packet =~ 60 ms)
      
      As such the first packet is now at most delayed by 300us.
      
      Under low transmit load, this will simply result in us sending
      a shorter aggregate, as originally intended.
      
      This patch has the benefit of greatly reducing (by ~10 factor
      with 1500 byte frames aggregated into 16 kiB) the number of
      (potentially pretty costly) updates to the hrtimer.
      
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Link: https://lore.kernel.org/r/20210608085438.813960-1-zenczykowski@gmail.com
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      1958ff5a
    • M
      USB: f_ncm: ncm_bitrate (speed) is unsigned · 33701397
      Maciej Żenczykowski 提交于
      [  190.544755] configfs-gadget gadget: notify speed -44967296
      
      This is because 4250000000 - 2**32 is -44967296.
      
      Fixes: 9f6ce424 ("usb: gadget: f_ncm.c added")
      Cc: Brooke Basile <brookebasile@gmail.com>
      Cc: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Lorenzo Colitti <lorenzo@google.com>
      Cc: Yauheni Kaliuta <yauheni.kaliuta@nokia.com>
      Cc: Linux USB Mailing List <linux-usb@vger.kernel.org>
      Acked-By: NLorenzo Colitti <lorenzo@google.com>
      Signed-off-by: NMaciej Żenczykowski <maze@google.com>
      Cc: stable <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/20210608005344.3762668-1-zenczykowski@gmail.comSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      33701397
  6. 04 6月, 2021 1 次提交
  7. 14 5月, 2021 1 次提交
    • J
      tty: make tty_operations::chars_in_buffer return uint · fff4ef17
      Jiri Slaby 提交于
      tty_operations::chars_in_buffer is another hook which is expected to
      return values >= 0. So make it explicit by the return type too -- use
      unsigned int.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-By: NAnton Ivanov <anton.ivanov@cambridgegreys.com>
      Acked-by: NDavid Sterba <dsterba@suse.com>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
      Cc: Jens Taprogge <jens.taprogge@taprogge.org>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Lin <dtwlin@gmail.com>
      Cc: Johan Hovold <johan@kernel.org>
      Cc: Alex Elder <elder@kernel.org>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Oliver Neukum <oneukum@suse.com>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Mathias Nyman <mathias.nyman@intel.com>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Cc: Johan Hedberg <johan.hedberg@gmail.com>
      Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
      Link: https://lore.kernel.org/r/20210505091928.22010-27-jslaby@suse.czSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      fff4ef17
  8. 13 5月, 2021 1 次提交
    • J
      tty: make tty_operations::write_room return uint · 03b3b1a2
      Jiri Slaby 提交于
      Line disciplines expect a positive value or zero returned from
      tty->ops->write_room (invoked by tty_write_room). So make this
      assumption explicit by using unsigned int as a return value. Both of
      tty->ops->write_room and tty_write_room.
      Signed-off-by: NJiri Slaby <jslaby@suse.cz>
      Acked-by: NLaurentiu Tudor <laurentiu.tudor@nxp.com>
      Acked-by: NAlex Elder <elder@linaro.org>
      Acked-by: Max Filippov <jcmvbkbc@gmail.com> # xtensa
      Acked-by: NDavid Sterba <dsterba@suse.com>
      Acked-By: NAnton Ivanov <anton.ivanov@cambridgegreys.com>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Cc: Richard Henderson <rth@twiddle.net>
      Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
      Cc: Matt Turner <mattst88@gmail.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Richard Weinberger <richard@nod.at>
      Cc: Chris Zankel <chris@zankel.net>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com>
      Cc: Jens Taprogge <jens.taprogge@taprogge.org>
      Cc: Karsten Keil <isdn@linux-pingi.de>
      Cc: Scott Branden <scott.branden@broadcom.com>
      Cc: Ulf Hansson <ulf.hansson@linaro.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Lin <dtwlin@gmail.com>
      Cc: Johan Hovold <johan@kernel.org>
      Cc: Jiri Kosina <jikos@kernel.org>
      Cc: Shawn Guo <shawnguo@kernel.org>
      Cc: Sascha Hauer <s.hauer@pengutronix.de>
      Cc: Oliver Neukum <oneukum@suse.com>
      Cc: Felipe Balbi <balbi@kernel.org>
      Cc: Mathias Nyman <mathias.nyman@intel.com>
      Cc: Marcel Holtmann <marcel@holtmann.org>
      Cc: Johan Hedberg <johan.hedberg@gmail.com>
      Cc: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
      Link: https://lore.kernel.org/r/20210505091928.22010-23-jslaby@suse.czSigned-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      03b3b1a2
  9. 10 5月, 2021 3 次提交
  10. 23 3月, 2021 7 次提交
  11. 18 3月, 2021 1 次提交