list_for_each_entry(ne, &whom->names_list, conn_entry) {
res = kdbus_policy_query_unlocked(db, conn->cred, ne->name,
- kdbus_str_hash(ne->name));
+ kdbus_strhash(ne->name));
if (res >= (int)access) {
pass = true;
break;
*/
bool kdbus_conn_policy_own_name(struct kdbus_conn *conn, const char *name)
{
- unsigned int hash = kdbus_str_hash(name);
+ unsigned int hash = kdbus_strhash(name);
int res;
if (conn->ep->has_policy) {
return true;
res = kdbus_policy_query_unlocked(&conn->ep->policy_db, conn->cred,
- name, kdbus_str_hash(name));
+ name, kdbus_strhash(name));
return res >= KDBUS_POLICY_SEE;
}
int ret = -ESRCH;
u32 hash;
- hash = kdbus_str_hash(name);
+ hash = kdbus_strhash(name);
/* lock order: domain -> bus -> ep -> names -> connection */
mutex_lock(&conn->ep->bus->lock);
const char *name)
{
struct kdbus_name_entry *e = NULL;
- u32 hash = kdbus_str_hash(name);
+ u32 hash = kdbus_strhash(name);
down_read(®->rwlock);
e = kdbus_name_lookup(reg, hash, name);
mutex_lock(&conn->ep->bus->lock);
down_write(®->rwlock);
- hash = kdbus_str_hash(name);
+ hash = kdbus_strhash(name);
e = kdbus_name_lookup(reg, hash, name);
if (e) {
/* connection already owns that name */
unsigned int hash;
/* reserve hash numbers 0, 1 and >=INT_MAX for magic directories */
- hash = kdbus_str_hash(name) & INT_MAX;
+ hash = kdbus_strhash(name) & INT_MAX;
if (hash < 2)
hash += 2;
if (hash >= INT_MAX)
goto exit_free;
*dot = '\0';
- hash = kdbus_str_hash(tmp);
+ hash = kdbus_strhash(tmp);
hash_for_each_possible(db->entries_hash, e, hentry, hash)
if (e->wildcard && strcmp(e->name, tmp) == 0) {
switch (a->type) {
case KDBUS_POLICY_ACCESS_USER:
- if (uid_eq(cred->uid, a->uid))
+ if (uid_eq(cred->euid, a->uid))
highest = a->access;
break;
case KDBUS_POLICY_ACCESS_GROUP:
hlist_for_each_entry_safe(e, tmp, &entries, hentry) {
/* prevent duplicates */
- hash = kdbus_str_hash(e->name);
+ hash = kdbus_strhash(e->name);
hash_for_each_possible(db->entries_hash, p, hentry, hash)
if (strcmp(e->name, p->name) == 0 &&
e->wildcard == p->wildcard) {
hlist_for_each_entry_safe(e, tmp, &restore, hentry) {
hlist_del(&e->hentry);
if (ret < 0) {
- hash = kdbus_str_hash(e->name);
+ hash = kdbus_strhash(e->name);
hash_add(db->entries_hash, &e->hentry, hash);
} else {
kdbus_policy_entry_free(e);
})
/**
- * kdbus_str_hash - calculate a hash
+ * kdbus_strhash - calculate a hash
* @str: String
*
* Return: hash value
*/
-static inline unsigned int kdbus_str_hash(const char *str)
+static inline unsigned int kdbus_strhash(const char *str)
{
unsigned long hash = init_name_hash();