The patch titled
     spi/spidev: check message size before copying
has been added to the -mm tree.  Its filename is
     spi-spidev-check-message-size-before-copying.patch

*** Remember to use Documentation/SubmitChecklist when testing your code ***

See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find
out what to do about this

------------------------------------------------------
Subject: spi/spidev: check message size before copying
From: Domen Puncer <[EMAIL PROTECTED]>

Message size needs to be checked before copying, or bad things could
happen.

Signed-off-by: Domen Puncer <[EMAIL PROTECTED]>
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
---

 drivers/spi/spidev.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff -puN drivers/spi/spidev.c~spi-spidev-check-message-size-before-copying 
drivers/spi/spidev.c
--- a/drivers/spi/spidev.c~spi-spidev-check-message-size-before-copying
+++ a/drivers/spi/spidev.c
@@ -168,6 +168,12 @@ static int spidev_message(struct spidev_
                        n--, k_tmp++, u_tmp++) {
                k_tmp->len = u_tmp->len;
 
+               total += k_tmp->len;
+               if (total > bufsiz) {
+                       status = -EMSGSIZE;
+                       goto done;
+               }
+
                if (u_tmp->rx_buf) {
                        k_tmp->rx_buf = buf;
                        if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len))
@@ -179,12 +185,6 @@ static int spidev_message(struct spidev_
                                        u_tmp->len))
                                goto done;
                }
-
-               total += k_tmp->len;
-               if (total > bufsiz) {
-                       status = -EMSGSIZE;
-                       goto done;
-               }
                buf += k_tmp->len;
 
                k_tmp->cs_change = !!u_tmp->cs_change;
_

Patches currently in -mm which might be from [EMAIL PROTECTED] are

mpc52xx_psc_spi-fix-it-for-config_ppc_merge.patch
spi-spidev-check-message-size-before-copying.patch

-
To unsubscribe from this list: send the line "unsubscribe mm-commits" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to