diff mbox series

[1/1] sel_avc_get_stat_idx should increase position index

Message ID dc87965f-e3e8-f9d0-ee1f-07ba14ac3575@virtuozzo.com (mailing list archive)
State Changes Requested
Headers show
Series [1/1] sel_avc_get_stat_idx should increase position index | expand

Commit Message

Vasily Averin Jan. 24, 2020, 6:32 a.m. UTC
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 <vvs@virtuozzo.com>
---
 security/selinux/selinuxfs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Paul Moore Jan. 31, 2020, 12:55 p.m. UTC | #1
On Fri, Jan 24, 2020 at 1:33 AM Vasily Averin <vvs@virtuozzo.com> wrote:
>
> 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 <vvs@virtuozzo.com>
> ---
>  security/selinux/selinuxfs.c | 1 +
>  1 file changed, 1 insertion(+)

It would be very nice if you could update this patch similar to what
you did for the keys subsystem (archive link below).  You included
most of that information in your cover letter, but unfortunately cover
letters don't make their way into the git log, only the individual
commit descriptions.

https://lore.kernel.org/linux-security-module/af9dcaa7-6e4f-281a-2bae-fb605cc55d2d@virtuozzo.com

Thank you.

> diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
> index ee94fa4..ad5530e 100644
> --- a/security/selinux/selinuxfs.c
> +++ b/security/selinux/selinuxfs.c
> @@ -1504,6 +1504,7 @@ static struct avc_cache_stats *sel_avc_get_stat_idx(loff_t *idx)
>                 *idx = cpu + 1;
>                 return &per_cpu(avc_cache_stats, cpu);
>         }
> +       (*idx)++;
>         return NULL;
>  }
>
> --
> 1.8.3.1
diff mbox series

Patch

diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c
index ee94fa4..ad5530e 100644
--- a/security/selinux/selinuxfs.c
+++ b/security/selinux/selinuxfs.c
@@ -1504,6 +1504,7 @@  static struct avc_cache_stats *sel_avc_get_stat_idx(loff_t *idx)
 		*idx = cpu + 1;
 		return &per_cpu(avc_cache_stats, cpu);
 	}
+	(*idx)++;
 	return NULL;
 }