public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Dominique Martinet <asmadeus@codewreck.org>
Cc: v9fs-developer@lists.sourceforge.net, linux_oss@crudebyte.com,
	linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com
Subject: Re: [PATCH 2/2] 9p: client_create: init fcall_cache earlier
Date: Thu, 29 Sep 2022 08:57:31 +0300	[thread overview]
Message-ID: <YzUzyw9JE4lFWKo5@unreal> (raw)
In-Reply-To: <20220928214417.1749609-2-asmadeus@codewreck.org>

On Thu, Sep 29, 2022 at 06:44:17AM +0900, Dominique Martinet wrote:
> fcall cache was init'd last for some reason, but we actually allocate
> some requests for the version check before that.
> Moving the cache creation towards the start also makes p9_client_destroy's
> order match the allocation order, which might be easier to think about
> 
> Signed-off-by: Dominique Martinet <asmadeus@codewreck.org>
> ---
>  net/9p/client.c | 20 +++++++++++---------
>  1 file changed, 11 insertions(+), 9 deletions(-)

Please submit it properly. It is unclear to which series you are
referring.

> 
> diff --git a/net/9p/client.c b/net/9p/client.c
> index 40b59431a566..1ea326e6e271 100644
> --- a/net/9p/client.c
> +++ b/net/9p/client.c
> @@ -977,6 +977,17 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
>  	if (err < 0)
>  		goto out;
>  
> +	/* P9_HDRSZ + 4 is the smallest packet header we can have that is
> +	 * followed by data accessed from userspace by read
> +	 * Note we do not check for failure here because the cache is
> +	 * optional; warning will be issued on dmesg for failure.
> +	 */
> +	clnt->fcall_cache =
> +		kmem_cache_create_usercopy("9p-fcall-cache", clnt->msize,
> +					   0, 0, P9_HDRSZ + 4,
> +					   clnt->msize - (P9_HDRSZ + 4),
> +					   NULL);
> +

clnt->msize can be changed after call to ->create() if it is larger than clnt->trans_mod->maxsize).

>  	if (!clnt->trans_mod)
>  		clnt->trans_mod = v9fs_get_default_trans();
>  
> @@ -1016,15 +1027,6 @@ struct p9_client *p9_client_create(const char *dev_name, char *options)
>  	if (err)
>  		goto out;
>  
> -	/* 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,
> -					   0, 0, P9_HDRSZ + 4,
> -					   clnt->msize - (P9_HDRSZ + 4),
> -					   NULL);
> -
>  	return clnt;
>  
>  out:
> -- 
> 2.35.1
> 

  reply	other threads:[~2022-09-29  5:57 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-25 11:29 [syzbot] KASAN: use-after-free Read in rdma_close syzbot
2022-09-28 10:07 ` Leon Romanovsky
2022-09-28 10:43   ` asmadeus
2022-09-28 10:49     ` Leon Romanovsky
2022-09-28 11:23       ` asmadeus
2022-09-28 11:54         ` Leon Romanovsky
2022-09-28 12:57           ` Christian Schoenebeck
2022-09-28 21:52             ` asmadeus
2022-09-29  6:10               ` Leon Romanovsky
2022-09-28 21:44   ` [PATCH 1/2] 9p: client_create/destroy: only call trans_mod->close after create Dominique Martinet
2022-09-28 21:44     ` [PATCH 2/2] 9p: client_create: init fcall_cache earlier Dominique Martinet
2022-09-29  5:57       ` Leon Romanovsky [this message]
2022-09-29  7:03         ` Dominique Martinet
2022-09-28 21:58     ` [PATCH 1/2 v2] 9p: client_create/destroy: only call trans_mod->close after create Dominique Martinet
2022-09-28 22:19       ` [PATCH v3] " Dominique Martinet
2022-09-29  5:54         ` Leon Romanovsky
2022-09-29  7:24           ` Dominique Martinet
2022-12-30 10:34 ` [syzbot] KASAN: use-after-free Read in rdma_close syzbot
2023-01-13 10:35 ` syzbot
2023-01-27 10:36 ` syzbot
2023-02-10 10:36 ` syzbot
2023-02-24 10:37 ` syzbot
2023-03-10 10:38 ` syzbot
2023-03-24 10:38 ` syzbot
2023-04-07 10:38 ` syzbot
2023-04-21 10:39 ` syzbot
2023-05-05 10:40 ` syzbot
2023-05-19 10:40 ` syzbot
2023-06-02 10:42 ` syzbot
2023-06-02 10:57   ` Aleksandr Nogikh

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=YzUzyw9JE4lFWKo5@unreal \
    --to=leon@kernel.org \
    --cc=asmadeus@codewreck.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox