From a36a216439c02a51dcd57aaee0436ebadd1032cf Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 2 Mar 2013 11:34:12 +0100 Subject: [PATCH] grsec compatibility (GH-48) The notifier_call member of struct notifier_block cannot be modified on grsec-patched kernels. Set the pointer on compile-time instead. --- bbswitch.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/bbswitch.c b/bbswitch.c index 2646f29..66192cd 100644 --- a/bbswitch.c +++ b/bbswitch.c @@ -72,8 +72,6 @@ static int dsm_type = DSM_TYPE_UNSUPPORTED; static struct pci_dev *dis_dev; static acpi_handle dis_handle; -/* used for keeping the PM event handler */ -static struct notifier_block nb; /* whether the card was off before suspend or not; on: 0, off: 1 */ static int dis_before_suspend_disabled; @@ -361,6 +359,10 @@ static struct file_operations bbswitch_fops = { .release= single_release }; +static struct notifier_block nb = { + .notifier_call = &bbswitch_pm_handler +}; + static int __init bbswitch_init(void) { struct proc_dir_entry *acpi_entry; struct pci_dev *pdev = NULL; @@ -443,7 +445,6 @@ static int __init bbswitch_init(void) { dis_dev_put(); - nb.notifier_call = &bbswitch_pm_handler; register_pm_notifier(&nb); return 0;