linux/drivers/net/ipa
Alex Elder 8d7b0b22ea net: ipa: compute DMA pool size properly
[ Upstream commit 6c75dc94f2 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2023-04-05 11:24:57 +02:00
..
gsi.c net: ipa: record proper RX transaction count 2022-05-25 09:57:30 +02:00
gsi.h net: ipa: disable GSI interrupts while suspended 2021-08-04 10:12:05 +01:00
gsi_private.h net: ipa: DMA addresses are nicely aligned 2021-03-28 18:12:03 -07:00
gsi_reg.h net: ipa: inter-EE interrupts aren't always available 2021-06-21 12:30:59 -07:00
gsi_trans.c net: ipa: compute DMA pool size properly 2023-04-05 11:24:57 +02:00
gsi_trans.h net: ipa: fix all kernel-doc warnings 2021-03-28 18:12:03 -07:00
ipa.h net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_cmd.c net: ipa: kill ipa_cmd_pipeline_clear() 2021-12-01 09:04:51 +01:00
ipa_cmd.h net: ipa: kill ipa_cmd_pipeline_clear() 2021-12-01 09:04:51 +01:00
ipa_data-v3.1.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data-v3.5.1.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data-v4.2.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data-v4.5.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data-v4.9.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data-v4.11.c net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_data.h net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_endpoint.c net: ipa: fix page free in ipa_endpoint_replenish_one() 2022-06-09 10:23:30 +02:00
ipa_endpoint.h net: ipa: prevent concurrent replenish 2022-02-05 12:38:56 +01:00
ipa_gsi.c net: ipa: include declarations in "ipa_gsi.c" 2020-07-07 12:43:18 -07:00
ipa_gsi.h net: ipa: fix kerneldoc comments 2020-07-13 17:11:53 -07:00
ipa_interrupt.c net: ipa: disable ipa interrupt during suspend 2023-02-01 08:27:11 +01:00
ipa_interrupt.h net: ipa: disable ipa interrupt during suspend 2023-02-01 08:27:11 +01:00
ipa_main.c net: ipa: separate disabling setup from modem stop 2021-12-01 09:04:51 +01:00
ipa_mem.c net: ipa: don't assume SMEM is page-aligned 2022-08-31 17:16:39 +02:00
ipa_mem.h net: ipa: don't index mem data array by ID 2021-06-10 14:50:08 -07:00
ipa_modem.c net: ipa: separate disabling setup from modem stop 2021-12-01 09:04:51 +01:00
ipa_modem.h net: ipa: kill ipa_modem_setup() 2021-07-26 23:09:18 +01:00
ipa_power.c net: ipa: disable ipa interrupt during suspend 2023-02-01 08:27:11 +01:00
ipa_power.h net: ipa: request IPA register values be retained 2022-04-20 09:34:05 +02:00
ipa_qmi.c net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipa_qmi.h net: ipa: kill ipa_modem_setup() 2021-07-26 23:09:18 +01:00
ipa_qmi_msg.c net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipa_qmi_msg.h net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipa_reg.c soc: qcom: ipa: main code 2020-03-08 22:07:09 -07:00
ipa_reg.h net: ipa: use WARN_ON() rather than assertions 2021-07-26 22:38:11 +01:00
ipa_resource.c net/ipa: ipa_resource: Fix wrong for loop range 2021-11-25 09:48:34 +01:00
ipa_resource.h net: ipa: get rid of empty IPA functions 2021-04-09 20:57:25 -07:00
ipa_smp2p.c net: ipa: separate disabling setup from modem stop 2021-12-01 09:04:51 +01:00
ipa_smp2p.h net: ipa: separate disabling setup from modem stop 2021-12-01 09:04:51 +01:00
ipa_sysfs.c net: ipa: introduce sysfs code 2021-06-11 14:13:18 -07:00
ipa_sysfs.h net: ipa: introduce sysfs code 2021-06-11 14:13:18 -07:00
ipa_table.c net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipa_table.h net: ipa: properly limit modem routing table use 2022-09-28 11:11:50 +02:00
ipa_uc.c net: ipa: request IPA register values be retained 2022-04-20 09:34:05 +02:00
ipa_uc.h net: ipa: rename ipa_clock_* symbols 2021-08-22 09:44:17 +01:00
ipa_version.h net: ipa: introduce sysfs code 2021-06-11 14:13:18 -07:00
Kconfig net: ipa: fix a build dependency 2022-04-20 09:34:21 +02:00
Makefile net: ipa: rename "ipa_clock.c" 2021-08-22 09:44:17 +01:00