History

keys: sparse: Fix key_fs[ug]id_changed()

Sparse warnings are incurred by key_fs[ug]id_changed() due to unprotected accesses of tsk->cred, which is marked __rcu. Fix this by passing the new cred struct to these functions from commit_creds() rather than the task pointer.

David Howells committed 7 years ago

Commit 2e218651 parent a1883393 files · +16 −18Browse files

Showing the changes to include/linux (1 of 3 files). Show all

Unified · Split

include/linux/key.h+4−4
@@ -402,8 +402,8 @@ extern struct ctl_table key_sysctls[]; · 401 unmodified lines
402402 * the userspace interface
403403 */
404404 extern int install_thread_keyring_to_cred(struct cred *cred);
405−extern void key_fsuid_changed(struct task_struct *tsk);
406−extern void key_fsgid_changed(struct task_struct *tsk);
405+extern void key_fsuid_changed(struct cred *new_cred);
406+extern void key_fsgid_changed(struct cred *new_cred);
407407 extern void key_init(void);
408408
409409 #else /* CONFIG_KEYS */
@@ -418,8 +418,8 @@ extern void key_init(void); · 8 unmodified lines
418418 #define make_key_ref(k, p) NULL
419419 #define key_ref_to_ptr(k) NULL
420420 #define is_key_possessed(k) 0
421−#define key_fsuid_changed(t) do { } while(0)
422−#define key_fsgid_changed(t) do { } while(0)
421+#define key_fsuid_changed(c) do { } while(0)
422+#define key_fsgid_changed(c) do { } while(0)
423423 #define key_init() do { } while(0)
424424
425425 #endif /* CONFIG_KEYS */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t