acrn-kernel/drivers/net/ipa
Alex Elder 6c75dc94f2 net: ipa: compute DMA pool size properly
In gsi_trans_pool_init_dma(), the total size of a pool of memory
used for DMA transactions is calculated.  However the calculation is
done incorrectly.

For 4KB pages, this total size is currently always more than one
page, and as a result, the calculation produces a positive (though
incorrect) total size.  The code still works in this case; we just
end up with fewer DMA pool entries than we intended.

Bjorn Andersson tested booting a kernel with 16KB pages, and hit a
null pointer derereference in sg_alloc_append_table_from_pages(),
descending from gsi_trans_pool_init_dma().  The cause of this was
that a 16KB total size was going to be allocated, and with 16KB
pages the order of that allocation is 0.  The total_size calculation
yielded 0, which eventually led to the crash.

Correcting the total_size calculation fixes the problem.

Reported-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Tested-by: Bjorn Andersson <quic_bjorande@quicinc.com>
Fixes: 9dd441e4ed ("soc: qcom: ipa: GSI transactions")
Reviewed-by: Mark Bloch <mbloch@nvidia.com>
Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Link: https://lore.kernel.org/r/20230328162751.2861791-1-elder@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-03-29 21:27:40 -07:00
..
data
reg net: ipa: fix a surprising number of bad offsets 2023-03-13 17:11:43 -07:00
Kconfig
Makefile net: ipa: add "gsi_v4.11.c" 2023-02-14 20:39:39 -08:00
gsi.c net: ipa: add HW_PARAM_4 GSI register 2023-02-20 08:14:20 +01:00
gsi.h net: ipa: kill gsi->virt_raw 2023-02-20 08:14:20 +01:00
gsi_private.h
gsi_reg.c net: ipa: fix some register validity checks 2023-03-16 21:33:18 -07:00
gsi_reg.h net: ipa: add two missing declarations 2023-03-16 21:33:18 -07:00
gsi_trans.c net: ipa: compute DMA pool size properly 2023-03-29 21:27:40 -07:00
gsi_trans.h
ipa.h
ipa_cmd.c
ipa_cmd.h
ipa_data.h
ipa_endpoint.c
ipa_endpoint.h
ipa_gsi.c
ipa_gsi.h
ipa_interrupt.c
ipa_interrupt.h
ipa_main.c ARM: SoC drivers for 6.3 2023-02-27 10:04:49 -08:00
ipa_mem.c IOMMU Updates for Linux v6.3: 2023-02-24 13:40:13 -08:00
ipa_mem.h
ipa_modem.c
ipa_modem.h
ipa_power.c
ipa_power.h
ipa_qmi.c
ipa_qmi.h
ipa_qmi_msg.c
ipa_qmi_msg.h
ipa_reg.c net: ipa: fix some register validity checks 2023-03-16 21:33:18 -07:00
ipa_reg.h net: ipa: fix some register validity checks 2023-03-16 21:33:18 -07:00
ipa_resource.c
ipa_resource.h
ipa_smp2p.c
ipa_smp2p.h
ipa_sysfs.c
ipa_sysfs.h
ipa_table.c
ipa_table.h
ipa_uc.c
ipa_uc.h
ipa_version.h
reg.h net: ipa: reg: include <linux/bug.h> 2023-03-16 21:33:18 -07:00