Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag 'selinux-pr-20221020' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux

Pull selinux fix from Paul Moore:
"A small SELinux fix for a GFP_KERNEL allocation while a spinlock is
held.

The patch, while still fairly small, is a bit larger than one might
expect from a simple s/GFP_KERNEL/GFP_ATOMIC/ conversion because we
added support for the function to be called with different gfp flags
depending on the context, preserving GFP_KERNEL for those cases that
can safely sleep"

* tag 'selinux-pr-20221020' of git://git.kernel.org/pub/scm/linux/kernel/git/pcmoore/selinux:
selinux: enable use of both GFP_KERNEL and GFP_ATOMIC in convert_context()

+6 -5
+3 -2
security/selinux/ss/services.c
··· 2022 2022 * in `newc'. Verify that the context is valid 2023 2023 * under the new policy. 2024 2024 */ 2025 - static int convert_context(struct context *oldc, struct context *newc, void *p) 2025 + static int convert_context(struct context *oldc, struct context *newc, void *p, 2026 + gfp_t gfp_flags) 2026 2027 { 2027 2028 struct convert_context_args *args; 2028 2029 struct ocontext *oc; ··· 2037 2036 args = p; 2038 2037 2039 2038 if (oldc->str) { 2040 - s = kstrdup(oldc->str, GFP_KERNEL); 2039 + s = kstrdup(oldc->str, gfp_flags); 2041 2040 if (!s) 2042 2041 return -ENOMEM; 2043 2042
+2 -2
security/selinux/ss/sidtab.c
··· 325 325 } 326 326 327 327 rc = convert->func(context, &dst_convert->context, 328 - convert->args); 328 + convert->args, GFP_ATOMIC); 329 329 if (rc) { 330 330 context_destroy(&dst->context); 331 331 goto out_unlock; ··· 404 404 while (i < SIDTAB_LEAF_ENTRIES && *pos < count) { 405 405 rc = convert->func(&esrc->ptr_leaf->entries[i].context, 406 406 &edst->ptr_leaf->entries[i].context, 407 - convert->args); 407 + convert->args, GFP_KERNEL); 408 408 if (rc) 409 409 return rc; 410 410 (*pos)++;
+1 -1
security/selinux/ss/sidtab.h
··· 65 65 }; 66 66 67 67 struct sidtab_convert_params { 68 - int (*func)(struct context *oldc, struct context *newc, void *args); 68 + int (*func)(struct context *oldc, struct context *newc, void *args, gfp_t gfp_flags); 69 69 void *args; 70 70 struct sidtab *target; 71 71 };