From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7FFB7185B5B; Fri, 15 Nov 2024 06:50:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731653429; cv=none; b=RUIoQmPTI7xM2oO82fsGmSZibGG0h02c4xpEvKHNxwUz+KrxTLjhMYKso6j++Rs9wMzgCn/o9EJYN0Ob2CuIUzG/kbxnnGhvu6giDBkrRZtkQdnVm++S3QWG9HHobunXEJW6u5MqItbx6AJ0vCm8OkxjkuTu1b1JhgZDRkOfUlE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731653429; c=relaxed/simple; bh=77P+iuF+4kZrU/4k+uV1YTrblhJ4yT5HcMu/iVH48Is=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A0zH6G844my/8b1jf6Pwp1Qm+7nRx9X+HTBpL0BjlAxXIiGcvkK+zW2s9FELH7+TzEUJyU14Mp5Yb+4hg56WqYczBktGLDKfb/vDJAsT6051eeMP7WwPCsVO1Ls0X6OidqqXkehToM5nmIvk8OFhHyqWzG0EFdI6kCDn+v/yQcA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=KOLhUVE8; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="KOLhUVE8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E54F5C4CECF; Fri, 15 Nov 2024 06:50:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1731653429; bh=77P+iuF+4kZrU/4k+uV1YTrblhJ4yT5HcMu/iVH48Is=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KOLhUVE8TuMyLxmituGQn51b5D5QnHPuabfrr31oC0uEzrdEFwi0OO/wgfH3XrIh2 m2aBKcZzviecCkAnepz4swVZAts1BAwFg/avb1NVwH6ZLEuCuvfliFJYNEOMSP3/7v OSQFzJSSywdTKX6xsee9bxxujBRZA5YNpCZs02IY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pedro Falcato , syzbot+3c5d43e97993e1fa612b@syzkaller.appspotmail.com, Dominique Martinet , Sasha Levin Subject: [PATCH 6.6 02/48] 9p: Avoid creating multiple slab caches with the same name Date: Fri, 15 Nov 2024 07:37:51 +0100 Message-ID: <20241115063723.053040091@linuxfoundation.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241115063722.962047137@linuxfoundation.org> References: <20241115063722.962047137@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Pedro Falcato [ 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 Reported-by: syzbot+3c5d43e97993e1fa612b@syzkaller.appspotmail.com Message-ID: <20240807094725.2193423-1-pedro.falcato@gmail.com> Signed-off-by: Dominique Martinet Signed-off-by: Sasha Levin --- 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 b05f73c291b4b..e7ea6c5c7463d 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -978,6 +978,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; clnt = kmalloc(sizeof(*clnt), GFP_KERNEL); if (!clnt) @@ -1034,15 +1035,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