diff options
Diffstat (limited to 'kernel/printk.c')
| -rw-r--r-- | kernel/printk.c | 23 |
1 files changed, 6 insertions, 17 deletions
diff --git a/kernel/printk.c b/kernel/printk.c index 07ad9e7f7a66..b51b1567bb55 100644 --- a/kernel/printk.c +++ b/kernel/printk.c | |||
| @@ -933,7 +933,7 @@ void suspend_console(void) | |||
| 933 | { | 933 | { |
| 934 | if (!console_suspend_enabled) | 934 | if (!console_suspend_enabled) |
| 935 | return; | 935 | return; |
| 936 | printk("Suspending console(s)\n"); | 936 | printk("Suspending console(s) (use no_console_suspend to debug)\n"); |
| 937 | acquire_console_sem(); | 937 | acquire_console_sem(); |
| 938 | console_suspended = 1; | 938 | console_suspended = 1; |
| 939 | } | 939 | } |
| @@ -1308,29 +1308,18 @@ void tty_write_message(struct tty_struct *tty, char *msg) | |||
| 1308 | } | 1308 | } |
| 1309 | 1309 | ||
| 1310 | #if defined CONFIG_PRINTK | 1310 | #if defined CONFIG_PRINTK |
| 1311 | |||
| 1311 | /* | 1312 | /* |
| 1312 | * printk rate limiting, lifted from the networking subsystem. | 1313 | * printk rate limiting, lifted from the networking subsystem. |
| 1313 | * | 1314 | * |
| 1314 | * This enforces a rate limit: not more than one kernel message | 1315 | * This enforces a rate limit: not more than 10 kernel messages |
| 1315 | * every printk_ratelimit_jiffies to make a denial-of-service | 1316 | * every 5s to make a denial-of-service attack impossible. |
| 1316 | * attack impossible. | ||
| 1317 | */ | 1317 | */ |
| 1318 | int __printk_ratelimit(int ratelimit_jiffies, int ratelimit_burst) | 1318 | DEFINE_RATELIMIT_STATE(printk_ratelimit_state, 5 * HZ, 10); |
| 1319 | { | ||
| 1320 | return __ratelimit(ratelimit_jiffies, ratelimit_burst); | ||
| 1321 | } | ||
| 1322 | EXPORT_SYMBOL(__printk_ratelimit); | ||
| 1323 | |||
| 1324 | /* minimum time in jiffies between messages */ | ||
| 1325 | int printk_ratelimit_jiffies = 5 * HZ; | ||
| 1326 | |||
| 1327 | /* number of messages we send before ratelimiting */ | ||
| 1328 | int printk_ratelimit_burst = 10; | ||
| 1329 | 1319 | ||
| 1330 | int printk_ratelimit(void) | 1320 | int printk_ratelimit(void) |
| 1331 | { | 1321 | { |
| 1332 | return __printk_ratelimit(printk_ratelimit_jiffies, | 1322 | return __ratelimit(&printk_ratelimit_state); |
| 1333 | printk_ratelimit_burst); | ||
| 1334 | } | 1323 | } |
| 1335 | EXPORT_SYMBOL(printk_ratelimit); | 1324 | EXPORT_SYMBOL(printk_ratelimit); |
| 1336 | 1325 | ||
