The functions stop_active_transfers and ep_disable are both calling
remove_requests. This functions in both cases will giveback the requests
with status ESHUTDOWN, which also represents an physical disconnection.
For ep_disable this is not true. This patch adds the status parameter to
remove_requests and sets the status to ECONNRESET on ep_disable.
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
Link: https://lore.kernel.org/r/20220720213523.1055897-1-m.grzeschik@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit b44c0e7fef)
Bug: 263189538
Change-Id: I1bd7a42e6f2f99a0ce021ef3c94dc630ae9260df
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
During a 3 stage SETUP transfer, if the host sends another SETUP token
before completing the status phase, it signifies that the host has aborted
the current control transfer. Currently, if a setup_packet_pending is
received, there are no subsequent calls to dwc3_ep0_out_start() to fetch
the new SETUP packet. This leads to a stall on EP0, as host does not
expect another STATUS phase as it has aborted the current transfer.
Fix this issue by explicitly stalling and restarting EP0, as well as
resetting the trb_enqueue indexes. (without this, there is a chance the
SETUP TRB is set up on trb_endqueue == 1)
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220712014403.2977-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 5e76ee96be)
Bug: 263189538
Change-Id: Ia0cc555ca8cd94048308406d975b3b4f4aa6ca54
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
The current logic to assign the max packet limit for IN endpoints attempts
to take the default HW value and apply the optimal endpoint settings based
on it. However, if the default value reports a TxFIFO size large enough
for only one max packet, it will divide the value and assign a smaller ep
max packet limit.
For example, if the default TxFIFO size fits 1024B, current logic will
assign 1024/3 = 341B to ep max packet size. If function drivers attempt to
request for an endpoint with a wMaxPacketSize of 1024B (SS BULK max packet
size) then it will fail, as the gadget is unable to find an endpoint which
can fit the requested size.
Functionally, if the TxFIFO has enough space to fit one max packet, it will
be sufficient, at least when initializing the endpoints.
Fixes: d94ea53198 ("usb: dwc3: gadget: Properly set maxpacket limit")
Cc: stable <stable@kernel.org>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220523213948.22142-1-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 9c1e916960)
Bug: 263189538
Change-Id: I56995b3d5bbfa8dc61a0e4084d6109d90951244d
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
The driver shouldn't be able to issue End Transfer to the control
endpoint at anytime. Typically we should only do so in error cases such
as invalid/unexpected direction of Data Phase as described in the
control transfer flow of the programming guide. It _may_ end started
data phase during controller deinitialization from soft disconnect or
driver removal. However, that should not happen because the driver
should be maintained in EP0_SETUP_PHASE during driver tear-down. On
soft-connect, the controller should be reset from a soft-reset and there
should be no issue starting the control endpoint.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/3c6643678863a26702e4115e9e19d7d94a30d49c.1650593829.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit ace17b6ee4)
Bug: 263189538
Change-Id: Ifd58ee4b1f213db72d6bcc7137c96ee2a399e21c
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
Since we can't guarantee that the host won't send new Setup packet
before going through the device-initiated disconnect, don't prepare
beyond the Setup stage and keep the device in EP0_SETUP_PHASE. This
ensures that the device-initated disconnect sequence can go through
gracefully. Note that the controller won't service the End Transfer
command if it can't DMA out the Setup packet.
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/6bacec56ecabb2c6e49a09cedfcac281fdc97de0.1650593829.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit c96683798e)
Bug: 263189538
Change-Id: Ice2d6837acebd312e732527504f4013f33a8fe6d
Signed-off-by: Krishna Kurapati <quic_kriskura@quicinc.com>
If mem-type is specified in the device tree
it would end up overriding the record_size
field instead of populating mem_type.
As record_size is currently parsed after the
improper assignment with default size 0 it
continued to work as expected regardless of the
value found in the device tree.
Simply changing the target field of the struct
is enough to get mem-type working as expected.
Fixes: 9d843e8faf ("pstore: Add mem_type property DT parsing support")
Cc: stable@vger.kernel.org
Signed-off-by: Luca Stefani <luca@osomprivacy.com>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20221222131049.286288-1-luca@osomprivacy.com
Fixes: 1c4893edfe ("FROMGIT: pstore: Add mem_type property DT parsing support")
Change-Id: Iea62cd7b26effc158500f097474d4df316285ac4
(cherry picked from commit beca3e311a )
Signed-off-by: Luca Stefani <luca@osomprivacy.com>
Otherwise, __lookup_extent_tree() will override the given extent_info which will
be used by caller.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit db640d99b1ed4745eaf3af9ea1910996cddaf30c)
Change-Id: Ib37a9ec57c24cfe303ee23a5e90618e6e0dabe61
Let's explicitly use the defined values in block_age case only.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 354a326851a615c7fd8f5a6bda72afc9f051c264)
Change-Id: I4011cbf10117a9023ef6fc507726020159ead72d
This can avoid confusing tracepoint values.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit b5825de803e7cf56262f5b3a8bc692d61acfe653)
Change-Id: Ia43e2c1fd405a11fc4122b68f05f40c10f47f263
This patch introduces a runtime hot/cold data separation method
for f2fs, in order to improve the accuracy for data temperature
classification, reduce the garbage collection overhead after
long-term data updates.
Enhanced hot/cold data separation can record data block update
frequency as "age" of the extent per inode, and take use of the age
info to indicate better temperature type for data block allocation:
- It records total data blocks allocated since mount;
- When file extent has been updated, it calculate the count of data
blocks allocated since last update as the age of the extent;
- Before the data block allocated, it searches for the age info and
chooses the suitable segment for allocation.
Test and result:
- Prepare: create about 30000 files
* 3% for cold files (with cold file extension like .apk, from 3M to 10M)
* 50% for warm files (with random file extension like .FcDxq, from 1K
to 4M)
* 47% for hot files (with hot file extension like .db, from 1K to 256K)
- create(5%)/random update(90%)/delete(5%) the files
* total write amount is about 70G
* fsync will be called for .db files, and buffered write will be used
for other files
The storage of test device is large enough(128G) so that it will not
switch to SSR mode during the test.
Benefit: dirty segment count increment reduce about 14%
- before: Dirty +21110
- after: Dirty +18286
Bug: 264453689
Signed-off-by: qixiaoyu1 <qixiaoyu1@xiaomi.com>
Signed-off-by: xiongping1 <xiongping1@xiaomi.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 729055d7f1e665c57c1c90b093501cb3eb47a876)
Change-Id: I8a62846bd3d44f7243300fa9653dbb623b46a96c
Let's allocate it to remove the runtime complexity.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 693658e0c0eca25087c1ffb318d85f8d392d6d27)
Change-Id: Ib46b6edd4f4a6232f3451498ee5c2f246dd37682
This patch prepares extent_cache to be ready for addition.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 7cf42d77c7242d23988215297bdd2d215e208b6f)
Change-Id: I5ca06c274529187b804ddd4b0834dc44fe6aa8ad
Added into the caller.
Bug: 264453689
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 0b461f459f0f53ff29b0ff98d4c18808b4248dcc)
Change-Id: Ic52ba22c00055bfe85bb789e6fd057d5fa84c00f
The trace_f2fs_update_extent_tree_range could not record compressed
block length in the cluster of compress file and we just add it.
Bug: 264453689
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit a95694e33ce998e808b3a72164e8df3b5e0faf87)
Change-Id: Ic3702b2735be27cf1eab34191313b162805a010a
The following scenarios exist.
process A: process B:
->f2fs_drop_extent_tree ->f2fs_update_extent_cache_range
->f2fs_update_extent_tree_range
->write_lock
->set_inode_flag
->is_inode_flag_set
->__free_extent_tree // Shouldn't
// have been
// cleaned up
// here
->write_lock
In this case, the "FI_NO_EXTENT" flag is set between
f2fs_update_extent_tree_range and is_inode_flag_set
by other process. it leads to clearing the whole exten
tree which should not have happened. And we fix it by
move the setting it to the range of write_lock.
Bug: 264453689
Fixes: 5f281fab9b ("f2fs: disable extent_cache for fcollapse/finsert inodes")
Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit a597af3b5a967e810cc8155abaa49abf10d6c417)
Change-Id: If36c3556c9062d46509f704f0491a7e6ad652ae6
Compressed inode may suffer read performance issue due to it can not
use extent cache, so I propose to add this unaligned extent support
to improve it.
Currently, it only works in readonly format f2fs image.
Unaligned extent: in one compressed cluster, physical block number
will be less than logical block number, so we add an extra physical
block length in extent info in order to indicate such extent status.
The idea is if one whole cluster blocks are contiguous physically,
once its mapping info was readed at first time, we will cache an
unaligned (or aligned) extent info entry in extent cache, it expects
that the mapping info will be hitted when rereading cluster.
Merge policy:
- Aligned extents can be merged.
- Aligned extent and unaligned extent can not be merged.
Bug: 264453689
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
(cherry picked from commit 627371ed31)
Change-Id: I106279145558f38dfa295c3e99fa03f6fcd306f4
Hunk extracted from commit 70aacfe661
upstream.
If the sqpoll thread has died, the out condition doesn't remove the
waiting task from the waitqueue. The goto and check are not needed, just
make it a break condition after setting the error value. That ensures
that we always remove ourselves from sqo_sq_wait waitqueue.
Bug: 259534862
Reported-by: Xingyuan Mo <hdthky0@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 0f544353fe)
Signed-off-by: Lee Jones <joneslee@google.com>
Change-Id: I453c3e23a2f0c5ce6a8dd73dac020ec6f32994ca
-Werror still fails on some arm and arm64 code due to clang issues
(works on gcc!), so disable it when building allmodconfig builds for
now.
Hopefully the clang developers will work on this...
Bug: 199872592
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I6ccc856773c40e3c0f541a1316b20e9ae3de4380
(cherry picked from commit eb57c31115)
Signed-off-by: Alistair Delva <adelva@google.com>
... but make it a config option so that broken environments can disable
it when required.
We really should always have a clean build, and will disable specific
over-eager warnings as required, if we can't fix them. But while I
fairly religiously enforce that in my own tree, it doesn't get enforced
by various build robots that don't necessarily report warnings.
So this just makes '-Werror' a default compiler flag, but allows people
to disable it for their configuration if they have some particular
issues.
Occasionally, new compiler versions end up enabling new warnings, and it
can take a while before we have them fixed (or the warnings disabled if
that is what it takes), so the config option allows for that situation.
Hopefully this will mean that I get fewer pull requests that have new
warnings that were not noticed by various automation we have in place.
Knock wood.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 3fe617ccaf)
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: If981f26ebe668be7c727661fede10215c4ee5bc5
Add 'dentry_path_raw' symbol to support some monitoring tools.
This patch does not add or remove symbol from xml file.
Bug: 264831214
Change-Id: I2b5aaa2945c5fd0ebe4062915b53407251a6ab77
Signed-off-by: Wu Bo <bo.wu@vivo.com>
crypto_memneq() is one of the utility functions that was intentionally
included in the fips140 module, out of concerns that it would be seen as
"cryptographic" and thus would be required to be included the module for
the FIPS certification. It should not have been removed from the
module, so add it back.
Bug: 188620248
Fixes: 18cd39b706 ("Merge tag 'android12-5.10.136_r00' into android12-5.10")
Change-Id: I8a19dfd73390f8c1348885f97fa42d900e47b82b
Signed-off-by: Eric Biggers <ebiggers@google.com>
Add fragment need by rockchip platform and sync the symbol list to the
latest source code.
This patch does not add or remove symbol from xml file.
Bug: 239396464
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
Change-Id: I54e37e865124cbc7f70646481ca798e27fcc4706
SPF attempts page faults without taking the mmap lock, but takes the
PTL. If there is a concurrent fast mremap (at PMD/PUD level), this
can lead to a UAF as fast mremap will only take the PTL locks at the
PMD/PUD level. SPF cannot take the PTL locks at the larger subtree
granularity since this introduces much contention in the page fault
paths.
To address the race:
1) Only try fast mremaps if there are no users of the VMA. Android
is concerned with this optimization in the context of
GC stop-the-world pause. So there are no other threads active
and this should almost always succeed.
2) Speculative faults detect ongoing fast mremaps and fallback
to conventional fault handling (taking mmap read lock).
Bug: 263177905
Change-Id: I23917e493ddc8576de19883cac053dfde9982b7f
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
Update symbols to symbol list externed by oppo network group.
1 Added function:
[A] 'function int __rtnl_link_register(rtnl_link_ops*)'
Bug: 193384408
Signed-off-by: Wei Liu <liuwei.a@oppo.com>
Change-Id: Ibd8f74fa1f3b68047f6fed9b5c4154c51f23b821
For the entropy analysis, we must provide some output from the Jitter
RNG: a large amount of output from one instance, and a smaller amount of
output from each of a certain number of instances.
The original plan was to use a build of the userspace jitterentropy
library that matches the kernel's jitterentropy_rng as closely as
possible. However, it's now being requested that the output be gotten
from the kernel instead.
Now that fips140_lab_util depends on AF_ALG anyway, it's straightforward
to dump output from jitterentropy_rng instances using AF_ALG.
Therefore, add a command dump_jitterentropy which supports this.
Bug: 188620248
Change-Id: I78eb26250e88f2fc28fc44aa201acbe5b84df8bb
Signed-off-by: Eric Biggers <ebiggers@google.com>
(cherry picked from commit dc01503266)
Splice is like read/write and should grab current->nsproxy, denoted by
IO_WQ_WORK_FILES as it refers to current->files as well
Change-Id: I94a99fdef5764e7eda5da778b5b52a150b9fe5eb
Signed-off-by: Bing-Jhong Billy Jheng <billy@starlabs.sg>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 75454b4bbf)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This reverts commit 501063ce66.
Reason for revert: The vendor hook is actually needed by a partner
Bug: 238821038
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I1c19add348792967975369a10ec9cb41fa268236
This reverts commit cc51dcbc60.
Reason for revert: The vendor hooks were reverted but they are needed.
Bug: 243629905
Signed-off-by: xiaofeng <xiaofeng5@xiaomi.com>
Signed-off-by: Suren Baghdasaryan <surenb@google.com>
Change-Id: I4b2eab1a9bf3bbbb200f9d09f2c57fb4d9f2c143
DWC3 controller soft reset is important operation for USB functionality.
In case when it fails, currently there is no failure log. Hence add
error log when core soft reset failed.
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 235863377
(cherry picked from commit 859bdc3595)
Change-Id: I60500f66af47d93cf9d60bdecab32e6dc48d4b7c
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
(cherry picked from commit d03bf01b43ff923e066938895a6867338778be7a)
The synchronous wakeup interface is available only for the
interruptible wakeup. Add it for normal wakeup and use this
synchronous wakeup interface to wakeup the userspace daemon.
Scheduler can make use of this hint to find a better CPU for
the waker task.
With this change the performance numbers for compress, decompress
and copy use-cases on /sdcard path has improved by ~30%.
Use-case details:
1. copy 10000 files of each 4k size into /sdcard path
2. use any File explorer application that has compress/decompress
support
3. start compress/decompress and capture the time.
-------------------------------------------------
| Default | wakeup support | Improvement/Diff |
-------------------------------------------------
| 13.8 sec | 9.9 sec | 3.9 sec (28.26%) |
-------------------------------------------------
Co-developed-by: Pavankumar Kondeti <quic_pkondeti@quicinc.com>
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
Bug: 216261533
Link: https://lore.kernel.org/lkml/1638780405-38026-1-git-send-email-quic_pragalla@quicinc.com/
Change-Id: I9ac89064e34b1e0605064bf4d2d3a310679cb605
Signed-off-by: Pradeep P V K <quic_pragalla@quicinc.com>
Signed-off-by: Alessio Balsini <balsini@google.com>
(cherry picked from commit 30d72758db)
SPF attempts page faults without taking the mmap lock, but takes the
PTL. If there is a concurrent fast mremap (at PMD/PUD level), this
can lead to a UAF as fast mremap will only take the PTL locks at the
PMD/PUD level. SPF cannot take the PTL locks at the larger subtree
granularity since this introduces much contention in the page fault
paths.
To address the race:
1) Fast mremaps wait until there are no users of the VMA.
2) Speculative faults detect ongoing fast mremaps and fallback
to conventional fault handling (taking mmap read lock).
Since this race condition is very rare the performance impact is
negligible.
Bug: 263177905
Change-Id: If9755aa4261337fe180e3093a3cefaae8ac9ff1a
Signed-off-by: Kalesh Singh <kaleshsingh@google.com>
To enable newer version of DualSense driver, i.e. hid-playstation, we
need to set LEDS_CLASS_MULTICOLOR to "y".
Bug: 260685629
Change-Id: I52b0b1b6a061457e009b62a6bd6b66a91c8c37a2
Signed-off-by: Farid Chahla <farid.chahla@sony.com>