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

Merge branch 'for-linus' of git://git.selinuxproject.org/~jmorris/linux-security

* 'for-linus' of git://git.selinuxproject.org/~jmorris/linux-security:
TOMOYO: Fix interactive judgment functionality.

+30
+30
security/tomoyo/common.c
··· 966 966 return found; 967 967 } 968 968 969 + static struct tomoyo_domain_info *tomoyo_find_domain_by_qid 970 + (unsigned int serial); 971 + 969 972 /** 970 973 * tomoyo_select_domain - Parse select command. 971 974 * ··· 1002 999 } else if (!strncmp(data, "domain=", 7)) { 1003 1000 if (tomoyo_domain_def(data + 7)) 1004 1001 domain = tomoyo_find_domain(data + 7); 1002 + } else if (sscanf(data, "Q=%u", &pid) == 1) { 1003 + domain = tomoyo_find_domain_by_qid(pid); 1005 1004 } else 1006 1005 return false; 1007 1006 head->w.domain = domain; ··· 1899 1894 /* Structure for query. */ 1900 1895 struct tomoyo_query { 1901 1896 struct list_head list; 1897 + struct tomoyo_domain_info *domain; 1902 1898 char *query; 1903 1899 size_t query_len; 1904 1900 unsigned int serial; ··· 2050 2044 goto out; 2051 2045 } 2052 2046 len = tomoyo_round2(entry.query_len); 2047 + entry.domain = r->domain; 2053 2048 spin_lock(&tomoyo_query_list_lock); 2054 2049 if (tomoyo_memory_quota[TOMOYO_MEMORY_QUERY] && 2055 2050 tomoyo_memory_used[TOMOYO_MEMORY_QUERY] + len ··· 2095 2088 out: 2096 2089 kfree(entry.query); 2097 2090 return error; 2091 + } 2092 + 2093 + /** 2094 + * tomoyo_find_domain_by_qid - Get domain by query id. 2095 + * 2096 + * @serial: Query ID assigned by tomoyo_supervisor(). 2097 + * 2098 + * Returns pointer to "struct tomoyo_domain_info" if found, NULL otherwise. 2099 + */ 2100 + static struct tomoyo_domain_info *tomoyo_find_domain_by_qid 2101 + (unsigned int serial) 2102 + { 2103 + struct tomoyo_query *ptr; 2104 + struct tomoyo_domain_info *domain = NULL; 2105 + spin_lock(&tomoyo_query_list_lock); 2106 + list_for_each_entry(ptr, &tomoyo_query_list, list) { 2107 + if (ptr->serial != serial || ptr->answer) 2108 + continue; 2109 + domain = ptr->domain; 2110 + break; 2111 + } 2112 + spin_unlock(&tomoyo_query_list_lock); 2113 + return domain; 2098 2114 } 2099 2115 2100 2116 /**