47 lines
1.3 KiB
Diff
47 lines
1.3 KiB
Diff
diff -up linux-3.2.noarch/fs/nfs/idmap.c.orig linux-3.2.noarch/fs/nfs/idmap.c
|
|
--- linux-3.2.noarch/fs/nfs/idmap.c.orig 2012-02-07 07:12:52.585471833 -0500
|
|
+++ linux-3.2.noarch/fs/nfs/idmap.c 2012-03-14 13:08:37.462928792 -0400
|
|
@@ -360,7 +360,7 @@ struct idmap_hashent {
|
|
unsigned long ih_expires;
|
|
__u32 ih_id;
|
|
size_t ih_namelen;
|
|
- char ih_name[IDMAP_NAMESZ];
|
|
+ const char *ih_name;
|
|
};
|
|
|
|
struct idmap_hashtable {
|
|
@@ -424,11 +424,16 @@ void
|
|
nfs_idmap_delete(struct nfs_client *clp)
|
|
{
|
|
struct idmap *idmap = clp->cl_idmap;
|
|
+ int i;
|
|
|
|
if (!idmap)
|
|
return;
|
|
rpc_unlink(idmap->idmap_dentry);
|
|
clp->cl_idmap = NULL;
|
|
+ for (i = 0; i < ARRAY_SIZE(idmap->idmap_user_hash.h_entries); i++)
|
|
+ kfree(idmap->idmap_user_hash.h_entries[i].ih_name);
|
|
+ for (i = 0; i < ARRAY_SIZE(idmap->idmap_group_hash.h_entries); i++)
|
|
+ kfree(idmap->idmap_group_hash.h_entries[i].ih_name);
|
|
kfree(idmap);
|
|
}
|
|
|
|
@@ -491,9 +496,14 @@ static void
|
|
idmap_update_entry(struct idmap_hashent *he, const char *name,
|
|
size_t namelen, __u32 id)
|
|
{
|
|
+ char *str = kmalloc(namelen + 1, GFP_KERNEL);
|
|
+ if (str == NULL)
|
|
+ return;
|
|
+ kfree(he->ih_name);
|
|
he->ih_id = id;
|
|
- memcpy(he->ih_name, name, namelen);
|
|
- he->ih_name[namelen] = '\0';
|
|
+ memcpy(str, name, namelen);
|
|
+ str[namelen] = '\0';
|
|
+ he->ih_name = str;
|
|
he->ih_namelen = namelen;
|
|
he->ih_expires = jiffies + nfs_idmap_cache_timeout;
|
|
}
|