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

    pktgen: correctly handle failures when adding a device

to the 3.7-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:
     pktgen-correctly-handle-failures-when-adding-a-device.patch
and it can be found in the queue-3.7 subdirectory.

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


>From 443811a0868d9d9815f4bbe1aabea6be7f25f906 Mon Sep 17 00:00:00 2001
From: Cong Wang <[email protected]>
Date: Sun, 27 Jan 2013 21:14:08 +0000
Subject: pktgen: correctly handle failures when adding a device


From: Cong Wang <[email protected]>

[ Upstream commit 604dfd6efc9b79bce432f2394791708d8e8f6efc ]

The return value of pktgen_add_device() is not checked, so
even if we fail to add some device, for example, non-exist one,
we still see "OK:...". This patch fixes it.

After this patch, I got:

        # echo "add_device non-exist" > /proc/net/pktgen/kpktgend_0
        -bash: echo: write error: No such device
        # cat /proc/net/pktgen/kpktgend_0
        Running:
        Stopped:
        Result: ERROR: can not add device non-exist
        # echo "add_device eth0" > /proc/net/pktgen/kpktgend_0
        # cat /proc/net/pktgen/kpktgend_0
        Running:
        Stopped: eth0
        Result: OK: add_device=eth0

(Candidate for -stable)

Cc: David S. Miller <[email protected]>
Signed-off-by: Cong Wang <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
 net/core/pktgen.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1795,10 +1795,13 @@ static ssize_t pktgen_thread_write(struc
                        return -EFAULT;
                i += len;
                mutex_lock(&pktgen_thread_lock);
-               pktgen_add_device(t, f);
+               ret = pktgen_add_device(t, f);
                mutex_unlock(&pktgen_thread_lock);
-               ret = count;
-               sprintf(pg_result, "OK: add_device=%s", f);
+               if (!ret) {
+                       ret = count;
+                       sprintf(pg_result, "OK: add_device=%s", f);
+               } else
+                       sprintf(pg_result, "ERROR: can not add device %s", f);
                goto out;
        }
 


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

queue-3.7/pktgen-correctly-handle-failures-when-adding-a-device.patch
--
To unsubscribe from this list: send the line "unsubscribe stable" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to