Skip to contentSkip to conversation

ASoC: Taint the kernel if debugfs is used to write directly to CODECs

PATCH In review Mark Brown 2 participants 2 messages Jan 6, 2011 – Jan 9, 2011

Subsystems (2)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Taint the kernel if debugfs is used to write directly to CODECs

Since direct register writes may confuse the drivers and are supposed to be used only in diagnostic situations discourage their use in production by tainting the kernel when we do a write.

---
 sound/soc/soc-core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
sound/soc/soc-core.c +4 -0
index a233607..dbca5023 100644
@@ -209,6 +209,10 @@ static ssize_t codec_reg_write_file(struct file *file,
 		start++;
 	if (strict_strtoul(start, 16, &value))
 		return -EINVAL;
+
+	/* Userspace has been fiddling around behind the kernel's back */
+	add_taint(TAINT_USER);
+
 	snd_soc_write(codec, reg, value);
 	return buf_size;
 }
Signature · 1 line
1.7.2.3
Acked-by on v1 1/1
#1 lore raw
Quoted 14 lines · Mark Brown

Since direct register writes may confuse the drivers and are supposed to be used only in diagnostic situations discourage their use in production by tainting the kernel when we do a write.

---
 sound/soc/soc-core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
sound/soc/soc-core.c +0 -0
index a233607..dbca5023 100644

sound/soc/soc-core.c static ssize_t codec_reg_write_file(struct file *file, · line 218

Quoted 10 lines
sound/soc/soc-core.c +4 -0
@@ -209,6 +209,10 @@ static ssize_t codec_reg_write_file(struct file *file,
 		start++;
 	if (strict_strtoul(start, 16, &value))
 		return -EINVAL;
+
+	/* Userspace has been fiddling around behind the kernel's back */
+	add_taint(TAINT_USER);
+
 	snd_soc_write(codec, reg, value);
 	return buf_size;
 }
Signature · 3 lines
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk