Merge tag 'selinux-pr-20221212' of git://git.kernel.org/pub/scm/linux/kernel/git...
[platform/kernel/linux-rpi.git] / security / selinux / ss / services.c
index e63c4f9..0092b29 100644 (file)
@@ -2013,6 +2013,7 @@ static inline int convert_context_handle_invalid_context(
  * @args: populated convert_context_args struct
  * @oldc: original context
  * @newc: converted context
+ * @gfp_flags: allocation flags
  *
  * Convert the values in the security context structure @oldc from the values
  * specified in the policy @args->oldp to the values specified in the policy
@@ -2020,7 +2021,8 @@ static inline int convert_context_handle_invalid_context(
  * context is valid under the new policy.
  */
 int services_convert_context(struct convert_context_args *args,
-                            struct context *oldc, struct context *newc)
+                            struct context *oldc, struct context *newc,
+                            gfp_t gfp_flags)
 {
        struct ocontext *oc;
        struct role_datum *role;
@@ -2031,7 +2033,7 @@ int services_convert_context(struct convert_context_args *args,
        int rc;
 
        if (oldc->str) {
-               s = kstrdup(oldc->str, GFP_KERNEL);
+               s = kstrdup(oldc->str, gfp_flags);
                if (!s)
                        return -ENOMEM;