Skip to content
Snippets Groups Projects
Commit c922d39e authored by Daniel Rosenberg's avatar Daniel Rosenberg Committed by Siqi Lin
Browse files

ANDROID: sdcardfs: Don't bother deleting freelist


There is no point deleting entries from dlist, as
that is a temporary list on the stack from which
contains only entries that are being deleted.

Not all code paths set up dlist, so those that
don't were performing invalid accesses in
hash_del_rcu. As an additional means to prevent
any other issue, we null out the list entries when
we allocate from the cache.

Bug: 35666680
Change-Id: Ibb1e28c08c3a600c29418d39ba1c0f3db3bf31e5
Signed-off-by: default avatarDaniel Rosenberg <drosen@google.com>
Signed-off-by: default avatarSiqi Lin <siqilin@google.com>
parent b032f9a3
No related branches found
No related tags found
No related merge requests found
...@@ -178,6 +178,8 @@ static struct hashtable_entry *alloc_hashtable_entry(const struct qstr *key, ...@@ -178,6 +178,8 @@ static struct hashtable_entry *alloc_hashtable_entry(const struct qstr *key,
GFP_KERNEL); GFP_KERNEL);
if (!ret) if (!ret)
return NULL; return NULL;
INIT_HLIST_NODE(&ret->dlist);
INIT_HLIST_NODE(&ret->hlist);
if (!qstr_copy(key, &ret->key)) { if (!qstr_copy(key, &ret->key)) {
kmem_cache_free(hashtable_entry_cachep, ret); kmem_cache_free(hashtable_entry_cachep, ret);
...@@ -326,7 +328,6 @@ static int insert_userid_exclude_entry(const struct qstr *key, userid_t value) ...@@ -326,7 +328,6 @@ static int insert_userid_exclude_entry(const struct qstr *key, userid_t value)
static void free_hashtable_entry(struct hashtable_entry *entry) static void free_hashtable_entry(struct hashtable_entry *entry)
{ {
kfree(entry->key.name); kfree(entry->key.name);
hash_del_rcu(&entry->dlist);
kmem_cache_free(hashtable_entry_cachep, entry); kmem_cache_free(hashtable_entry_cachep, entry);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment