seq_file: constify seq_operations
Make all seq_operations structs const, to help mitigate against revectoring user-triggerable function pointers. This is derived from the grsecurity patch, although generated from scratch because it's simpler than extracting the changes from there. Signed-off-by: James Morris <jmorris@namei.org> Acked-by: Serge Hallyn <serue@us.ibm.com> Acked-by: Casey Schaufler <casey@schaufler-ca.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
b7ed698cc9
commit
88e9d34c72
@@ -386,9 +386,9 @@ static int table_seq_show(struct seq_file *seq, void *iter_ptr)
|
||||
return rv;
|
||||
}
|
||||
|
||||
static struct seq_operations format1_seq_ops;
|
||||
static struct seq_operations format2_seq_ops;
|
||||
static struct seq_operations format3_seq_ops;
|
||||
static const struct seq_operations format1_seq_ops;
|
||||
static const struct seq_operations format2_seq_ops;
|
||||
static const struct seq_operations format3_seq_ops;
|
||||
|
||||
static void *table_seq_start(struct seq_file *seq, loff_t *pos)
|
||||
{
|
||||
@@ -534,21 +534,21 @@ static void table_seq_stop(struct seq_file *seq, void *iter_ptr)
|
||||
}
|
||||
}
|
||||
|
||||
static struct seq_operations format1_seq_ops = {
|
||||
static const struct seq_operations format1_seq_ops = {
|
||||
.start = table_seq_start,
|
||||
.next = table_seq_next,
|
||||
.stop = table_seq_stop,
|
||||
.show = table_seq_show,
|
||||
};
|
||||
|
||||
static struct seq_operations format2_seq_ops = {
|
||||
static const struct seq_operations format2_seq_ops = {
|
||||
.start = table_seq_start,
|
||||
.next = table_seq_next,
|
||||
.stop = table_seq_stop,
|
||||
.show = table_seq_show,
|
||||
};
|
||||
|
||||
static struct seq_operations format3_seq_ops = {
|
||||
static const struct seq_operations format3_seq_ops = {
|
||||
.start = table_seq_start,
|
||||
.next = table_seq_next,
|
||||
.stop = table_seq_stop,
|
||||
|
Reference in New Issue
Block a user