linux/drivers/soc/qcom
Alex Elder 7df5ff258b soc: qcom: qmi: fix a buffer sizing bug
In qmi_handle_init(), a buffer is allocated for to hold messages
received through the handle's socket.  Any "normal" messages
(expected by the caller) will have a header prepended, so the
buffer size is adjusted to accomodate that.

The buffer must also be of sufficient size to receive control
messages, so the size is increased if necessary to ensure these
will fit.

Unfortunately the calculation is done wrong, making it possible
for the calculated buffer size to be too small to hold a "normal"
message.  Specifically, if:

  recv_buf_size > sizeof(struct qrtr_ctrl_pkt) - sizeof(struct qmi_header)
		AND
  recv_buf_size < sizeof(struct qrtr_ctrl_pkt)

the current logic will use sizeof(struct qrtr_ctrl_pkt) as the
receive buffer size, which is not enough to hold the maximum
"normal" message plus its header.  Currently this problem occurs
for (13 < recv_buf_size < 20).

This patch corrects this.

Signed-off-by: Alex Elder <elder@linaro.org>
Reviewed-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Andy Gross <andy.gross@linaro.org>
2018-05-25 15:53:58 -05:00
..
cmd-db.c soc: qcom: cmd-db: Make endian-agnostic 2018-05-25 15:53:52 -05:00
glink_ssr.c soc: qcom: GLINK SSR notifier 2017-08-02 12:43:29 -07:00
Kconfig drivers: qcom: add command DB driver 2018-05-25 15:53:52 -05:00
Makefile drivers: qcom: add command DB driver 2018-05-25 15:53:52 -05:00
mdt_loader.c soc: qcom: mdt-loader: Return relocation base 2018-02-12 11:05:38 -08:00
qcom_gsbi.c
qcom-geni-se.c soc: qcom: Add GENI based QUP Wrapper driver 2018-04-25 00:12:05 -05:00
qmi_encdec.c soc: qcom: Introduce QMI encoder/decoder 2017-12-20 15:38:34 -06:00
qmi_interface.c soc: qcom: qmi: fix a buffer sizing bug 2018-05-25 15:53:58 -05:00
rmtfs_mem.c soc: qcom: rmtfs-mem: Add support for assigning memory to remote 2018-03-08 18:40:24 -06:00
smd-rpm.c soc: qcom: smd-rpm: Add msm8998 compatible 2018-04-25 00:11:28 -05:00
smem_state.c soc: qcom: Update properties for smem state referencing 2016-06-24 22:53:41 -05:00
smem.c soc: qcom: smem: check sooner in qcom_smem_set_global_partition() 2018-05-25 15:53:56 -05:00
smp2p.c soc: qcom: smp2p: Use common error handling code in qcom_smp2p_probe() 2018-01-01 00:29:09 -06:00
smsm.c soc: qcom: smsm: fix child-node lookup 2017-12-20 15:38:34 -06:00
spm.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next 2016-05-17 16:26:30 -07:00
wcnss_ctrl.c soc: qcom: wcnss_ctrl: Fix increment in NV upload 2018-03-08 18:40:35 -06:00