summaryrefslogtreecommitdiffstats
path: root/drivers/input/rmi4/rmi_f12.c
diff options
context:
space:
mode:
authorAndrew Duggan <aduggan@synaptics.com>2019-11-04 16:07:30 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-20 16:49:05 +0100
commit6ffa897341104761c64d4fc8e749fa51f29cf49e (patch)
treea00e2cac2a8ed84014763be58e9dcc4ceae35f57 /drivers/input/rmi4/rmi_f12.c
parente5995d6552db04e1c72d2b85a6eda75a314a12dc (diff)
downloadlinux-stable-6ffa897341104761c64d4fc8e749fa51f29cf49e.tar.gz
linux-stable-6ffa897341104761c64d4fc8e749fa51f29cf49e.tar.bz2
linux-stable-6ffa897341104761c64d4fc8e749fa51f29cf49e.zip
Input: synaptics-rmi4 - do not consume more data than we have (F11, F12)
commit 5d40d95e7e64756cc30606c2ba169271704d47cb upstream. Currently, rmi_f11_attention() and rmi_f12_attention() functions update the attn_data data pointer and size based on the size of the expected size of the attention data. However, if the actual valid data in the attn buffer is less then the expected value then the updated data pointer will point to memory beyond the end of the attn buffer. Using the calculated valid_bytes instead will prevent this from happening. Signed-off-by: Andrew Duggan <aduggan@synaptics.com> Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20191025002527.3189-3-aduggan@synaptics.com Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/input/rmi4/rmi_f12.c')
-rw-r--r--drivers/input/rmi4/rmi_f12.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/input/rmi4/rmi_f12.c b/drivers/input/rmi4/rmi_f12.c
index 734077f2c40b..7e97944f7616 100644
--- a/drivers/input/rmi4/rmi_f12.c
+++ b/drivers/input/rmi4/rmi_f12.c
@@ -212,8 +212,8 @@ static irqreturn_t rmi_f12_attention(int irq, void *ctx)
valid_bytes = sensor->attn_size;
memcpy(sensor->data_pkt, drvdata->attn_data.data,
valid_bytes);
- drvdata->attn_data.data += sensor->attn_size;
- drvdata->attn_data.size -= sensor->attn_size;
+ drvdata->attn_data.data += valid_bytes;
+ drvdata->attn_data.size -= valid_bytes;
} else {
retval = rmi_read_block(rmi_dev, f12->data_addr,
sensor->data_pkt, sensor->pkt_size);