]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - fs/seq_file.c
[MAC80211]: fix add_interface monitor mode behaviour
[mirror_ubuntu-zesty-kernel.git] / fs / seq_file.c
index e8e51db4989d9123bd0d8c6eb13a3a0346bf30e7..bbb19be260ced1be701c3651f8e5b6a94a0bb593 100644 (file)
@@ -177,21 +177,23 @@ EXPORT_SYMBOL(seq_read);
 
 static int traverse(struct seq_file *m, loff_t offset)
 {
-       loff_t pos = 0;
+       loff_t pos = 0, index;
        int error = 0;
        void *p;
 
        m->version = 0;
-       m->index = 0;
+       index = 0;
        m->count = m->from = 0;
-       if (!offset)
+       if (!offset) {
+               m->index = index;
                return 0;
+       }
        if (!m->buf) {
                m->buf = kmalloc(m->size = PAGE_SIZE, GFP_KERNEL);
                if (!m->buf)
                        return -ENOMEM;
        }
-       p = m->op->start(m, &m->index);
+       p = m->op->start(m, &index);
        while (p) {
                error = PTR_ERR(p);
                if (IS_ERR(p))
@@ -204,15 +206,17 @@ static int traverse(struct seq_file *m, loff_t offset)
                if (pos + m->count > offset) {
                        m->from = offset - pos;
                        m->count -= m->from;
+                       m->index = index;
                        break;
                }
                pos += m->count;
                m->count = 0;
                if (pos == offset) {
-                       m->index++;
+                       index++;
+                       m->index = index;
                        break;
                }
-               p = m->op->next(m, p, &m->index);
+               p = m->op->next(m, p, &index);
        }
        m->op->stop(m, p);
        return error;