[PATCH 1/1] NTFS: Fix a potential DoS by rate limiting printk().

From: Anton Altaparmakov
Date: Tue Jan 25 2005 - 05:57:26 EST


This is patch 1/1 in the series. It contains the following ChangeSet:

<aia21@xxxxxxxxxx> (05/01/25 1.1983.6.1)
NTFS: Add printk rate limiting for ntfs_warning() and ntfs_error() when
compiled without debug. This avoids a possible denial of service
attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this
out.

Best regards,

Anton
--
Anton Altaparmakov <aia21 at cam.ac.uk> (replace at with @)
Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
Linux NTFS maintainer / IRC: #ntfs on irc.freenode.net
WWW: http://linux-ntfs.sf.net/, http://www-stu.christs.cam.ac.uk/~aia21/

===================================================================

diff -Nru a/fs/ntfs/ChangeLog b/fs/ntfs/ChangeLog
--- a/fs/ntfs/ChangeLog 2005-01-25 10:50:37 +00:00
+++ b/fs/ntfs/ChangeLog 2005-01-25 10:50:37 +00:00
@@ -25,6 +25,13 @@
- Enable the code for setting the NT4 compatibility flag when we start
making NTFS 1.2 specific modifications.

+2.1.23-WIP
+
+ - Add printk rate limiting for ntfs_warning() and ntfs_error() when
+ compiled without debug. This avoids a possible denial of service
+ attack. Thanks to Carl-Daniel Hailfinger from SuSE for pointing this
+ out.
+
2.1.22 - Many bug and race fixes and error handling improvements.

- Improve error handling in fs/ntfs/inode.c::ntfs_truncate().
diff -Nru a/fs/ntfs/debug.c b/fs/ntfs/debug.c
--- a/fs/ntfs/debug.c 2005-01-25 10:50:37 +00:00
+++ b/fs/ntfs/debug.c 2005-01-25 10:50:37 +00:00
@@ -53,6 +53,10 @@
va_list args;
int flen = 0;

+#ifndef DEBUG
+ if (!printk_ratelimit())
+ return;
+#endif
if (function)
flen = strlen(function);
spin_lock(&err_buf_lock);
@@ -93,6 +97,10 @@
va_list args;
int flen = 0;

+#ifndef DEBUG
+ if (!printk_ratelimit())
+ return;
+#endif
if (function)
flen = strlen(function);
spin_lock(&err_buf_lock);
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/