From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Pedro Falcato <pedro.falcato@gmail.com>,
syzbot+3c5d43e97993e1fa612b@syzkaller.appspotmail.com,
Dominique Martinet <asmadeus@codewreck.org>,
Sasha Levin <sashal@kernel.org>,
ericvh@kernel.org, lucho@ionkov.net, v9fs@lists.linux.dev
Subject: [PATCH AUTOSEL 5.10 1/6] 9p: Avoid creating multiple slab caches with the same name
Date: Wed, 23 Oct 2024 10:32:48 -0400 [thread overview]
Message-ID: <20241023143257.2982585-1-sashal@kernel.org> (raw)
From: Pedro Falcato <pedro.falcato@gmail.com>
[ 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>
---
net/9p/client.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/9p/client.c b/net/9p/client.c
index 0fa324e8b2451..2668a1a67c8a8 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -1006,6 +1006,7 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
int err;
struct p9_client *clnt;
char *client_id;
+ char *cache_name;
err = 0;
clnt = kmalloc(sizeof(struct p9_client), GFP_KERNEL);
@@ -1058,15 +1059,22 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
if (err)
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
* followed by data accessed from userspace by read
*/
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,
clnt->msize - (P9_HDRSZ + 4),
NULL);
+ kfree(cache_name);
return clnt;
close_trans:
--
2.43.0
next reply other threads:[~2024-10-23 14:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-23 14:32 Sasha Levin [this message]
2024-10-23 14:32 ` [PATCH AUTOSEL 5.10 2/6] HID: multitouch: Add quirk for HONOR MagicBook Art 14 touchpad Sasha Levin
2024-10-23 14:32 ` [PATCH AUTOSEL 5.10 3/6] bpf: use kvzmalloc to allocate BPF verifier environment Sasha Levin
2024-10-23 14:32 ` [PATCH AUTOSEL 5.10 4/6] crypto: marvell/cesa - Disable hash algorithms Sasha Levin
2024-10-23 14:32 ` [PATCH AUTOSEL 5.10 5/6] sound: Make CONFIG_SND depend on INDIRECT_IOMEM instead of UML Sasha Levin
2024-10-23 14:32 ` [PATCH AUTOSEL 5.10 6/6] powerpc/powernv: Free name on error in opal_event_init() Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241023143257.2982585-1-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=asmadeus@codewreck.org \
--cc=ericvh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lucho@ionkov.net \
--cc=pedro.falcato@gmail.com \
--cc=stable@vger.kernel.org \
--cc=syzbot+3c5d43e97993e1fa612b@syzkaller.appspotmail.com \
--cc=v9fs@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.