if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <[email protected]>
---
 fs/dlm/debug_fs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
index d6bbccb..c1eda93 100644
--- a/fs/dlm/debug_fs.c
+++ b/fs/dlm/debug_fs.c
@@ -523,7 +523,7 @@ static void *table_seq_next(struct seq_file *seq, void 
*iter_ptr, loff_t *pos)
                ri->rsb = r;
                spin_unlock(&ls->ls_rsbtbl[bucket].lock);
                dlm_put_rsb(rp);
-               ++*pos;
+               ++(*pos);
                return ri;
        }
        spin_unlock(&ls->ls_rsbtbl[bucket].lock);
@@ -542,6 +542,7 @@ static void *table_seq_next(struct seq_file *seq, void 
*iter_ptr, loff_t *pos)
 
                if (bucket >= ls->ls_rsbtbl_size) {
                        kfree(ri);
+                       ++(*pos);
                        return NULL;
                }
                tree = toss ? &ls->ls_rsbtbl[bucket].toss : 
&ls->ls_rsbtbl[bucket].keep;
-- 
1.8.3.1


Reply via email to