[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <FB8A4655DFD2B34DB16AE06DDDD6C0E21BDBB7CD@SJEXCHMB12.corp.ad.broadcom.com>
Date: Tue, 19 Nov 2013 21:22:58 +0000
From: "Charley (Hao Chuan) Chu" <charley.chu@...adcom.com>
To: "Linus Torvalds" <torvalds@...ux-foundation.org>,
"Al Viro" <viro@...iv.linux.org.uk>
cc: "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] FS: Fixed buffer overflow issue in seq_read()
> m->from is a red herring - it's not even looked at if m->count is 0.
Then, shall the initialization here be removed too?
@@ -90,7 +90,7 @@ static int traverse(struct seq_file *m, loff_t offset)
m->version = 0;
index = 0;
- m->count = m->from = 0;
+ m->count = 0;
if (!offset) {
m->index = index;
return 0;
> What do you think about then just abstracing out that now common sequence
> of re-allocating a larger buffer, while clearing m->count?
Following code is duplicated (slightly different) in both seq_read() and seq_lseek().
It would be nice to have them consolidated in traverse().
while ((err = traverse(m, *ppos)) == -EAGAIN)
;
if (err) {
/* With prejudice... */
m->read_pos = 0;
m->version = 0;
m->index = 0;
m->count = 0;
goto Done;
} else {
m->read_pos = *ppos;
}
Thanks,
Charley
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists