Skip to contentSkip to conversation

Patch "iio: ad5755: fix off-by-one on devnr limit check" has been added to the 4.8-stable tree

PATCH [email protected] 1 participant 1 message Oct 28, 2016

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

iio: ad5755: fix off-by-one on devnr limit check

to the 4.8-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:

     iio-ad5755-fix-off-by-one-on-devnr-limit-check.patch

and it can be found in the queue-4.8 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From 9d47964bfd471f0dd4c89f28556aec68bffa0020 Mon Sep 17 00:00:00 2001

From: Colin Ian King <[email protected]>
Date: Mon, 25 Jul 2016 23:40:01 +0100
Subject: iio: ad5755: fix off-by-one on devnr limit check

From: Colin Ian King <[email protected]>

commit 9d47964bfd471f0dd4c89f28556aec68bffa0020 upstream.

The comparison for devnr limits is off-by-one, the current check allows 0 to AD5755_NUM_CHANNELS and the limit should be in fact 0 to AD5755_NUM_CHANNELS - 1. This can lead to an out of bounds write to pdata->dac[devnr]. Fix this by replacing > with >= on the comparison.

Fixes c947459979c6 ("iio: ad5755: add support for dt bindings")
---
 drivers/iio/dac/ad5755.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/dac/ad5755.c +1 -1
@@ -655,7 +655,7 @@ static struct ad5755_platform_data *ad57
 
 	devnr = 0;
 	for_each_child_of_node(np, pp) {
-		if (devnr > AD5755_NUM_CHANNELS) {
+		if (devnr >= AD5755_NUM_CHANNELS) {
 			dev_err(dev,
 				"There is to many channels defined in DT\n");
 			goto error_out;

Patches currently in stable-queue which might be from [email protected] are

queue-4.8/iio-ad5755-fix-off-by-one-on-devnr-limit-check.patch