Skip to contentSkip to conversation

mbcs: add .owner to mbcs struct file_operations

PATCH New [email protected] 1 participant 1 message Jan 22, 2019 Char and misc drivers

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 mbcs: add .owner to mbcs struct file_operations

From: Naveen Kumar Parna <[email protected]>

Without ".owner = THIS_MODULE" it is possible to crash the kernel by unloading the mbcs module while someone works with the file. Fix this by initializing the ‘struct file_operations' ->owner with THIS_MODULE.

---
 drivers/char/mbcs.c | 1 +
 1 file changed, 1 insertion(+)
drivers/char/mbcs.c +1 -0
index 8c9216a0f62e..0a31b60bee7b 100644
@@ -50,6 +50,7 @@ static LIST_HEAD(soft_list);
  * file operations
  */
 static const struct file_operations mbcs_ops = {
+	.owner = THIS_MODULE,
 	.open = mbcs_open,
 	.llseek = mbcs_sram_llseek,
 	.read = mbcs_sram_read,
Signature · 1 line
2.17.1