snic_trc_seq_next should increase position index
Subsystems (2)
PATCH 1/1 snic_trc_seq_next should increase position index
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
--- drivers/scsi/snic/snic_debugfs.c | 1 + 1 file changed, 1 insertion(+)
drivers/scsi/snic/snic_debugfs.c +1 -0
@@ -419,6 +419,7 @@ void snic_stats_debugfs_init(struct snic *snic)static void *snic_trc_seq_next (struct seq_file *sfp,void *data,loff_t *pos) { + (*pos)++;return NULL ; }
Signature · 1 line
1.8.3.1
James, Martin,
I did not get any feedback from Cisco developers,
could you please pick up this patch?
Unfortunately I have no related hardware and cannot verify the patch.
Usually you can observe following related problems:
- read after lseek beyond end of file, described by NeilBrown in
commit 1f4aace60b0e ("fs/seq_file.c: simplify seq_file iteration code and interface") "dd if=<AFFECTED_FILE> bs=1000 skip=1" will incorrectly generate whole last line
- read after lseek on into middle of last line will output expected rest of last line but then repeat whole last line once again.
- If .show() function generates multi-line output following bash script will never finish.
$ q=;while read -r r;do echo "$((++q)) $r";done < AFFECTED_FILE
Quoted 22 lines · Vasily Averin
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]>--- drivers/scsi/snic/snic_debugfs.c | 1 + 1 file changed, 1 insertion(+)drivers/scsi/snic/snic_debugfs.c +1
-0@@ -419,6 +419,7 @@ void snic_stats_debugfs_init(struct snic *snic)static void *snic_trc_seq_next (struct seq_file *sfp,void *data,loff_t *pos) { + (*pos)++;return NULL ; }