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

    isdn/gigaset: ratelimit CAPI message dumps

to the 3.4-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:
     isdn-gigaset-ratelimit-capi-message-dumps.patch
and it can be found in the queue-3.4 subdirectory.

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


>From 8e618aad5348b6e6c5a90e8d97ea643197963b20 Mon Sep 17 00:00:00 2001
From: Tilman Schmidt <[email protected]>
Date: Wed, 25 Apr 2012 13:02:19 +0000
Subject: isdn/gigaset: ratelimit CAPI message dumps

From: Tilman Schmidt <[email protected]>

commit 8e618aad5348b6e6c5a90e8d97ea643197963b20 upstream.

Introduce a global ratelimit for CAPI message dumps to protect
against possible log flood.
Drop the ratelimit for ignored messages which is now covered by the
global one.

Signed-off-by: Tilman Schmidt <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>

---
 drivers/isdn/gigaset/capi.c |   22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

--- a/drivers/isdn/gigaset/capi.c
+++ b/drivers/isdn/gigaset/capi.c
@@ -14,6 +14,7 @@
 #include "gigaset.h"
 #include <linux/proc_fs.h>
 #include <linux/seq_file.h>
+#include <linux/ratelimit.h>
 #include <linux/isdn/capilli.h>
 #include <linux/isdn/capicmd.h>
 #include <linux/isdn/capiutil.h>
@@ -223,10 +224,14 @@ get_appl(struct gigaset_capi_ctr *iif, u
 static inline void dump_cmsg(enum debuglevel level, const char *tag, _cmsg *p)
 {
 #ifdef CONFIG_GIGASET_DEBUG
+       /* dump at most 20 messages in 20 secs */
+       static DEFINE_RATELIMIT_STATE(msg_dump_ratelimit, 20 * HZ, 20);
        _cdebbuf *cdb;
 
        if (!(gigaset_debuglevel & level))
                return;
+       if (!___ratelimit(&msg_dump_ratelimit, tag))
+               return;
 
        cdb = capi_cmsg2str(p);
        if (cdb) {
@@ -2059,12 +2064,6 @@ static void do_reset_b3_req(struct gigas
 }
 
 /*
- * dump unsupported/ignored messages at most twice per minute,
- * some apps send those very frequently
- */
-static unsigned long ignored_msg_dump_time;
-
-/*
  * unsupported CAPI message handler
  */
 static void do_unsupported(struct gigaset_capi_ctr *iif,
@@ -2073,8 +2072,7 @@ static void do_unsupported(struct gigase
 {
        /* decode message */
        capi_message2cmsg(&iif->acmsg, skb->data);
-       if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000))
-               dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
+       dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
        send_conf(iif, ap, skb, CapiMessageNotSupportedInCurrentState);
 }
 
@@ -2085,11 +2083,9 @@ static void do_nothing(struct gigaset_ca
                       struct gigaset_capi_appl *ap,
                       struct sk_buff *skb)
 {
-       if (printk_timed_ratelimit(&ignored_msg_dump_time, 30 * 1000)) {
-               /* decode message */
-               capi_message2cmsg(&iif->acmsg, skb->data);
-               dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
-       }
+       /* decode message */
+       capi_message2cmsg(&iif->acmsg, skb->data);
+       dump_cmsg(DEBUG_CMD, __func__, &iif->acmsg);
        dev_kfree_skb_any(skb);
 }
 


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

queue-3.4/isdn-gigaset-improve-error-handling-querying-firmware-version.patch
queue-3.4/isdn-gigaset-fix-capi-disconnect-b3-handling.patch
queue-3.4/isdn-gigaset-ratelimit-capi-message-dumps.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