From: "Anna Schumaker" <anna@kernel.org>
To: "Jérémy Jean" <Jeremy.Jean@oss.cyber.gouv.fr>, linux-nfs@vger.kernel.org
Cc: "Trond Myklebust" <trondmy@kernel.org>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] NFSv4.1: initialize referring call pointers before decoding
Date: Thu, 20 Aug 2026 13:21:39 -0400 [thread overview]
Message-ID: <ae822c8b-9d47-4a96-a61b-aef730c4c785@app.fastmail.com> (raw)
In-Reply-To: <20260817211600.1651876-2-Jeremy.Jean@oss.cyber.gouv.fr>
Hi Jeremy,
On Mon, Aug 17, 2026, at 5:16 PM, Jérémy Jean wrote:
> decode_cb_sequence_args() allocates csa_rclists with kmalloc_objs(), so
> each referring_call_list starts uninitialized. decode_rc_list() assigns
> rcl_refcalls only when rcl_nrefcalls is nonzero. A valid list with zero
> referring calls therefore leaves the pointer uninitialized, and
> nfs4_callback_sequence() later passes it to kfree(). KASAN reports a
> double free in nfs_cb_sequence_empty_refcalls_test().
>
> Initialize the pointer before decoding the list.
>
> Fixes: 4aece6a19cf7 ("nfs41: cb_sequence xdr implementation")
> Assisted-by: Codex:gpt-5
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> ---
> fs/nfs/callback_xdr.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
> index 4382baddc9ee..5857f57f0644 100644
> --- a/fs/nfs/callback_xdr.c
> +++ b/fs/nfs/callback_xdr.c
> @@ -360,6 +360,7 @@ static __be32 decode_rc_list(struct xdr_stream *xdr,
> int i;
> __be32 status;
>
> + rc_list->rcl_refcalls = NULL;
I think I would rather have this initialized to NULL from the beginning.
Could you instead update decode_cb_sequence_args() to use kzalloc_objs()
when allocating the referring_call_lists?
Thanks,
Anna
> status = decode_sessionid(xdr, &rc_list->rcl_sessionid);
> if (status)
> goto out;
> --
> 2.47.3
prev parent reply other threads:[~2026-08-20 17:22 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 21:16 Jérémy Jean
2026-08-20 17:21 ` Anna Schumaker [this message]
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=ae822c8b-9d47-4a96-a61b-aef730c4c785@app.fastmail.com \
--to=anna@kernel.org \
--cc=Jeremy.Jean@oss.cyber.gouv.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=trondmy@kernel.org \
/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
all inboxes | Powered by JetHome®