hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/security/apparmor/include/file.h
....@@ -1,3 +1,4 @@
1
+/* SPDX-License-Identifier: GPL-2.0-only */
12 /*
23 * AppArmor security module
34 *
....@@ -5,11 +6,6 @@
56 *
67 * Copyright (C) 1998-2008 Novell/SUSE
78 * Copyright 2009-2010 Canonical Ltd.
8
- *
9
- * This program is free software; you can redistribute it and/or
10
- * modify it under the terms of the GNU General Public License as
11
- * published by the Free Software Foundation, version 2 of the
12
- * License.
139 */
1410
1511 #ifndef __AA_FILE_H
....@@ -32,7 +28,10 @@
3228 AA_MAY_CHMOD | AA_MAY_CHOWN | AA_MAY_LOCK | \
3329 AA_EXEC_MMAP | AA_MAY_LINK)
3430
35
-#define file_ctx(X) ((struct aa_file_ctx *)(X)->f_security)
31
+static inline struct aa_file_ctx *file_ctx(struct file *file)
32
+{
33
+ return file->f_security + apparmor_blob_sizes.lbs_file;
34
+}
3635
3736 /* struct aa_file_ctx - the AppArmor context the file was opened in
3837 * @lock: lock to update the ctx
....@@ -73,7 +72,7 @@
7372 {
7473 if (ctx) {
7574 aa_put_label(rcu_access_pointer(ctx->label));
76
- kzfree(ctx);
75
+ kfree_sensitive(ctx);
7776 }
7877 }
7978
....@@ -198,7 +197,7 @@
198197 const struct path *new_dir, struct dentry *new_dentry);
199198
200199 int aa_file_perm(const char *op, struct aa_label *label, struct file *file,
201
- u32 request);
200
+ u32 request, bool in_atomic);
202201
203202 void aa_inherit_files(const struct cred *cred, struct files_struct *files);
204203