mbcs: add .owner to mbcs struct file_operations
authorNaveen Kumar Parna <parna.naveenkumar@gmail.com>
Tue, 22 Jan 2019 13:44:02 +0000 (19:14 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 22 Jan 2019 13:56:00 +0000 (14:56 +0100)
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.

Signed-off-by: Naveen Kumar Parna <parna.naveenkumar@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/char/mbcs.c

index 8c9216a0f62ec64683015e69f805904854ac429c..0a31b60bee7b8e181c2ae5de68f84c143d278f52 100644 (file)
@@ -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,