linux-stable/drivers/net/ipa
Alex Elder f0a83c083e 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>
2023-04-06 12:12:38 +02:00
..
data net: ipa: correct IPA v4.7 IMEM offset 2023-01-09 07:26:59 +00:00
reg net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
gsi.c net: ipa: generic command param fix 2023-03-10 09:28:17 +01:00
gsi.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
gsi_private.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
gsi_reg.h net: ipa: generic command param fix 2023-03-10 09:28:17 +01:00
gsi_trans.c net: ipa: compute DMA pool size properly 2023-04-06 12:12:38 +02:00
gsi_trans.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa.h net: ipa: use a bitmap for enabled endpoints 2022-11-04 10:16:53 +00:00
ipa_cmd.c net: ipa: determine filter table size from memory region 2022-10-27 13:38:13 +02:00
ipa_cmd.h net: ipa: introduce ipa_cmd_init() 2022-10-25 11:15:19 +02:00
ipa_data.h net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
ipa_endpoint.c net: ipa: use a bitmap for enabled endpoints 2022-11-04 10:16:53 +00:00
ipa_endpoint.h net: ipa: support more filtering endpoints 2022-11-04 10:16:53 +00:00
ipa_gsi.c
ipa_gsi.h
ipa_interrupt.c net: ipa: disable ipa interrupt during suspend 2023-01-17 19:04:13 -08:00
ipa_interrupt.h net: ipa: disable ipa interrupt during suspend 2023-01-17 19:04:13 -08:00
ipa_main.c net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
ipa_mem.c net: ipa: change an IPA v5.0 memory requirement 2022-10-28 22:06:46 -07:00
ipa_mem.h
ipa_modem.c net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_modem.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_power.c net: ipa: disable ipa interrupt during suspend 2023-01-17 19:04:13 -08:00
ipa_power.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_qmi.c net: ipa: don't assume 8 modem routing table entries 2022-10-27 13:38:13 +02:00
ipa_qmi.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_qmi_msg.c net: ipa: Make QMI message rules const 2022-10-21 12:39:16 +01:00
ipa_qmi_msg.h net: ipa: Make QMI message rules const 2022-10-21 12:39:16 +01:00
ipa_reg.c net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
ipa_reg.h net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
ipa_resource.c net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_resource.h
ipa_smp2p.c net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_smp2p.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_sysfs.c net: ipa: use sysfs_emit() to instead of scnprintf() 2022-12-05 11:03:49 +00:00
ipa_sysfs.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_table.c net: ipa: avoid a null pointer dereference 2022-11-18 11:46:18 +00:00
ipa_table.h net: ipa: support more filtering endpoints 2022-11-04 10:16:53 +00:00
ipa_uc.c net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_uc.h net: ipa: update copyrights 2022-10-03 16:49:20 -07:00
ipa_version.h net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00
Kconfig net: ipa: add an interconnect dependency 2022-03-02 22:14:05 -08:00
Makefile net: ipa: add IPA v4.7 support 2022-12-12 15:55:06 -08:00