diff options
| author | T Pratham <[email protected]> | 2025-03-19 11:14:38 +0000 |
|---|---|---|
| committer | Andrew Morton <[email protected]> | 2025-04-01 22:20:46 +0000 |
| commit | 8b46fdaea819a679da176b879e7b0674a1161a5e (patch) | |
| tree | 6484266b129070faa48a0ea6c1d630809131dfc8 /drivers/pci/controller/dwc/pcie-qcom-common.c | |
| parent | lib/sort.c: add _nonatomic() variants with cond_resched() (diff) | |
| download | kernel-8b46fdaea819a679da176b879e7b0674a1161a5e.tar.gz kernel-8b46fdaea819a679da176b879e7b0674a1161a5e.zip | |
lib: scatterlist: fix sg_split_phys to preserve original scatterlist offsets
The split_sg_phys function was incorrectly setting the offsets of all
scatterlist entries (except the first) to 0. Only the first scatterlist
entry's offset and length needs to be modified to account for the skip.
Setting the rest entries' offsets to 0 could lead to incorrect data
access.
I am using this function in a crypto driver that I'm currently developing
(not yet sent to mailing list). During testing, it was observed that the
output scatterlists (except the first one) contained incorrect garbage
data.
I narrowed this issue down to the call of sg_split(). Upon debugging
inside this function, I found that this resetting of offset is the cause
of the problem, causing the subsequent scatterlists to point to incorrect
memory locations in a page. By removing this code, I am obtaining
expected data in all the split output scatterlists. Thus, this was indeed
causing observable runtime effects!
This patch removes the offending code, ensuring that the page offsets in
the input scatterlist are preserved in the output scatterlist.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: f8bcbe62acd0 ("lib: scatterlist: add sg splitting function")
Signed-off-by: T Pratham <[email protected]>
Cc: Robert Jarzmik <[email protected]>
Cc: Jens Axboe <[email protected]>
Cc: Kamlesh Gurudasani <[email protected]>
Cc: Praneeth Bajjuri <[email protected]>
Cc: Vignesh Raghavendra <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'drivers/pci/controller/dwc/pcie-qcom-common.c')
0 files changed, 0 insertions, 0 deletions
