From e0e98bb31f5cbb75cd8efb4d7585eac4af423498 Mon Sep 17 00:00:00 2001 From: Richard Fuchs Date: Tue, 10 Dec 2013 05:43:49 -0500 Subject: [PATCH] prevent endless read of proc/status file --- kernel-module/xt_MEDIAPROXY.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel-module/xt_MEDIAPROXY.c b/kernel-module/xt_MEDIAPROXY.c index 383e3a151..01104e8d7 100644 --- a/kernel-module/xt_MEDIAPROXY.c +++ b/kernel-module/xt_MEDIAPROXY.c @@ -578,7 +578,9 @@ static ssize_t proc_status(struct file *f, char __user *b, size_t l, loff_t *o) unsigned long flags; u_int32_t id; - if (*o) + if (*o > 0) + return 0; + if (*o < 0) return -EINVAL; if (l < sizeof(buf)) return -EINVAL; @@ -600,6 +602,7 @@ static ssize_t proc_status(struct file *f, char __user *b, size_t l, loff_t *o) if (copy_to_user(b, buf, len)) return -EFAULT; + *o += len; return len; }