mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
9p: Avoid creating multiple slab caches with the same name
[ Upstream commit 79efebae4afc2221fa814c3cae001bede66ab259 ] In the spirit of [1], avoid creating multiple slab caches with the same name. Instead, add the dev_name into the mix. [1]: https://lore.kernel.org/all/20240807090746.2146479-1-pedro.falcato@gmail.com/ Signed-off-by: Pedro Falcato <pedro.falcato@gmail.com> Reported-by: syzbot+3c5d43e97993e1fa612b@syzkaller.appspotmail.com Message-ID: <20240807094725.2193423-1-pedro.falcato@gmail.com> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
a63c78c349
commit
0d6c0b3b6f
1 changed files with 9 additions and 1 deletions
|
@ -978,6 +978,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
|
||||||
int err;
|
int err;
|
||||||
struct p9_client *clnt;
|
struct p9_client *clnt;
|
||||||
char *client_id;
|
char *client_id;
|
||||||
|
char *cache_name;
|
||||||
|
|
||||||
clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
|
clnt = kmalloc(sizeof(*clnt), GFP_KERNEL);
|
||||||
if (!clnt)
|
if (!clnt)
|
||||||
|
@ -1034,15 +1035,22 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
|
||||||
if (err)
|
if (err)
|
||||||
goto close_trans;
|
goto close_trans;
|
||||||
|
|
||||||
|
cache_name = kasprintf(GFP_KERNEL, "9p-fcall-cache-%s", dev_name);
|
||||||
|
if (!cache_name) {
|
||||||
|
err = -ENOMEM;
|
||||||
|
goto close_trans;
|
||||||
|
}
|
||||||
|
|
||||||
/* P9_HDRSZ + 4 is the smallest packet header we can have that is
|
/* P9_HDRSZ + 4 is the smallest packet header we can have that is
|
||||||
* followed by data accessed from userspace by read
|
* followed by data accessed from userspace by read
|
||||||
*/
|
*/
|
||||||
clnt->fcall_cache =
|
clnt->fcall_cache =
|
||||||
kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
|
kmem_cache_create_usercopy(cache_name, clnt->msize,
|
||||||
0, 0, P9_HDRSZ + 4,
|
0, 0, P9_HDRSZ + 4,
|
||||||
clnt->msize - (P9_HDRSZ + 4),
|
clnt->msize - (P9_HDRSZ + 4),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
kfree(cache_name);
|
||||||
return clnt;
|
return clnt;
|
||||||
|
|
||||||
close_trans:
|
close_trans:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue