Linux kernel source tree
Go to file
Peng Hongchi 1134289b6b usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled
When using dma_map_sg() to map the scatterlist with iommu enabled,
the entries in the scatterlist can be mergerd into less but longer
entries in the function __finalise_sg(). So that the number of
valid mapped entries is actually smaller than ureq->num_reqs,and
there are still some invalid entries in the scatterlist with
dma_addr=0xffffffff and len=0. Writing these invalid sg entries
into the dma_desc can cause a data transmission error.

The function dma_map_sg() returns the number of valid map entries
and the return value is assigned to usb_request::num_mapped_sgs in
function usb_gadget_map_request_by_dev(). So that just write valid
mapped entries into dma_desc according to the usb_request::num_mapped_sgs,
and set the IOC bit if it's the last valid mapped entry.

This patch poses no risk to no-iommu situation, cause
ureq->num_mapped_sgs equals ureq->num_sgs while using dma_direct_map_sg()
to map the scatterlist whith iommu disabled.

Signed-off-by: Peng Hongchi <hongchi.peng@siengine.com>
Link: https://lore.kernel.org/r/20240523100315.7226-1-hongchi.peng@siengine.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-06-04 15:41:26 +02:00
arch Miscellaneous topology parsing fixes: 2024-06-02 09:32:34 -07:00
block blk-throttle: Fix incorrect display of io.max 2024-05-30 19:44:29 -06:00
certs
crypto This push fixes a bug in the new ecc P521 code as well as a buggy 2024-05-20 08:47:54 -07:00
Documentation usb-storage: Optimize scan delay more precisely 2024-06-04 15:40:47 +02:00
drivers usb: dwc2: gadget: Don't write invalid mapped sg entries into dma_desc with iommu enabled 2024-06-04 15:41:26 +02:00
fs 2 small smb3 fixes 2024-06-01 14:35:57 -07:00
include TTY fix for 6.10-rc2 2024-06-01 08:53:39 -07:00
init Driver core changes for 6.10-rc1 2024-05-22 12:13:40 -07:00
io_uring io_uring/net: assign kmsg inq/flags before buffer selection 2024-05-30 14:04:37 -06:00
ipc Mainly singleton patches, documented in their respective changelogs. 2024-05-19 14:02:03 -07:00
kernel Kbuild fixes for v6.10 2024-06-01 09:33:55 -07:00
lib kunit/fortify: Remove __kmalloc_node() test 2024-05-31 13:47:41 -07:00
LICENSES
mm 16 hotfixes, 11 of which are cc:stable. 2024-05-25 15:10:33 -07:00
net Including fixes from bpf and netfilter. 2024-05-30 08:33:04 -07:00
rust LoongArch changes for v6.10 2024-05-22 09:43:07 -07:00
samples tracing/treewide: Remove second parameter of __assign_str() 2024-05-22 20:14:47 -04:00
scripts dt-bindings: kbuild: Fix dt_binding_check on unconfigured build 2024-05-30 01:15:58 +09:00
security landlock: Fix d_parent walk 2024-05-31 16:41:52 +02:00
sound ALSA: seq: ump: Fix swapped song position pointer data 2024-05-31 09:51:44 +02:00
tools Landlock fix for v6.10-rc2 2024-06-01 08:28:24 -07:00
usr
virt The usual shower of singleton fixes and minor series all over MM, 2024-05-19 09:21:03 -07:00
.clang-format
.cocciconfig
.editorconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap mailmap: update entry for Kees Cook 2024-05-31 08:58:36 -07:00
.rustfmt.toml
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS sound fixes for 6.10-rc2 2024-05-31 12:11:44 -07:00
Makefile Linux 6.10-rc2 2024-06-02 15:44:56 -07:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the reStructuredText markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.