Linux-NFS Archive mirror
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "Alessandro Zanni" <alessandro.zanni87@gmail.com>,
	"Chuck Lever" <chuck.lever@oracle.com>,
	"Jeff Layton" <jlayton@kernel.org>, NeilBrown <neil@brown.name>,
	"Olga Kornievskaia" <okorniev@redhat.com>,
	"Dai Ngo" <Dai.Ngo@oracle.com>, "Tom Talpey" <tom@talpey.com>,
	"Trond Myklebust" <trondmy@kernel.org>,
	"Anna Schumaker" <anna@kernel.org>,
	davem@davemloft.net, edumazet@google.com,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Simon Horman" <horms@kernel.org>
Cc: linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	syzbot+60cfa08822470bbebe44@syzkaller.appspotmail.com
Subject: Re: [PATCH] net: sunrpc: fix slab-out-of-bounds read in cache_seq_start_rcu
Date: Tue, 28 Apr 2026 09:56:42 -0400	[thread overview]
Message-ID: <f13ad5ba-1b1e-4bf9-8acb-07b5530e1da5@app.fastmail.com> (raw)
In-Reply-To: <20260428134230.136533-1-alessandro.zanni87@gmail.com>



On Tue, Apr 28, 2026, at 9:42 AM, Alessandro Zanni wrote:
> Syzbot reported slab-out-of-bounds read in cache_seq_start_rcu().
>
> The issue happens in function __cache_seq_start() when is invoked
> hlist_for_each_entry_rcu() and the hash value is greater than the
> hash_size.
>
> This fix verifies that the hash index is within the hash_size value
> before dereferencing the hash table: if the hash index is out of
> bounds return NULL, otherwise access the value.
>
> Fixes: ae74136b4bb6 ("SUNRPC: Allow cache lookups to use RCU protection 
> rather than the r/w spinlock")
> Reported-by: syzbot+60cfa08822470bbebe44@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=60cfa08822470bbebe44
> Signed-off-by: Alessandro Zanni <alessandro.zanni87@gmail.com>
> ---
>  net/sunrpc/cache.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c
> index 7081c1214e6c..aac5f03112f5 100644
> --- a/net/sunrpc/cache.c
> +++ b/net/sunrpc/cache.c
> @@ -1348,6 +1348,9 @@ static void *__cache_seq_start(struct seq_file 
> *m, loff_t *pos)
>  	hash = n >> 32;
>  	entry = n & ((1LL<<32) - 1);
> 
> +	if (hash >= cd->hash_size)
> +		return NULL;
> +
>  	hlist_for_each_entry_rcu(ch, &cd->hash_table[hash], cache_list)
>  		if (!entry--)
>  			return ch;
> -- 
> 2.47.3

Thank you for the patch! We have this fixed in the nfsd-testing
tree already:

https://git.kernel.org/pub/scm/linux/kernel/git/cel/linux.git/commit/?h=nfsd-testing&id=72fe9e528c68aa7b9ed5afab98c44f8b83bbe287


-- 
Chuck Lever

      reply	other threads:[~2026-04-28 13:57 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28 13:42 [PATCH] net: sunrpc: fix slab-out-of-bounds read in cache_seq_start_rcu Alessandro Zanni
2026-04-28 13:56 ` Chuck Lever [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=f13ad5ba-1b1e-4bf9-8acb-07b5530e1da5@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=Dai.Ngo@oracle.com \
    --cc=alessandro.zanni87@gmail.com \
    --cc=anna@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neil@brown.name \
    --cc=netdev@vger.kernel.org \
    --cc=okorniev@redhat.com \
    --cc=pabeni@redhat.com \
    --cc=syzbot+60cfa08822470bbebe44@syzkaller.appspotmail.com \
    --cc=tom@talpey.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).