[PATCH] Fix sysctl unregistration oops (CVE-2005-2709)
[sfrench/cifs-2.6.git] / arch / s390 / appldata / appldata_base.c
index c9f2f60cfa5808929e9d4515d709cad7f726a5c6..dee6ab54984d03d6358a54476191aa18fb2ee05d 100644 (file)
@@ -592,12 +592,15 @@ int appldata_register_ops(struct appldata_ops *ops)
  */
 void appldata_unregister_ops(struct appldata_ops *ops)
 {
+       void *table;
        spin_lock(&appldata_ops_lock);
-       unregister_sysctl_table(ops->sysctl_header);
        list_del(&ops->list);
-       kfree(ops->ctl_table);
+       /* at that point any incoming access will fail */
+       table = ops->ctl_table;
        ops->ctl_table = NULL;
        spin_unlock(&appldata_ops_lock);
+       unregister_sysctl_table(ops->sysctl_header);
+       kfree(table);
        P_INFO("%s-ops unregistered!\n", ops->name);
 }
 /********************** module-ops management <END> **************************/