Linux NFS development
 help / color / mirror / Atom feed
From: "Chuck Lever" <cel@kernel.org>
To: "zhangjian (CG)" <zhangjian496@huawei.com>,
	"Steve Dickson" <steved@redhat.com>
Cc: linux-nfs@vger.kernel.org, "Chuck Lever" <chuck.lever@oracle.com>
Subject: Re: nfsd: fix memory overflow for haddr
Date: Tue, 14 Jul 2026 11:16:24 -0400	[thread overview]
Message-ID: <dfd0efac-0d06-47f5-a9bd-04b26f4061af@app.fastmail.com> (raw)
In-Reply-To: <356736aa-25d8-4b79-a50f-33b4e7035856@huawei.com>

Hi -


On Tue, Jul 14, 2026, at 4:43 AM, zhangjian (CG) wrote:
> when hcounter is not 0, haddr memory is not enough.
> asan report heap-buffer-overflow error in following scene:
> CFLAGS="-fsanitize=address -g" ./configure && make
> ./utils/nfsd/nfsd -H 192.168.1.1 -H 192.168.1.2
>
> Signed-off-by: zhangjian <zhangjian496@huawei.com>
> ---
>  utils/nfsd/nfsd.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/utils/nfsd/nfsd.c b/utils/nfsd/nfsd.c
> index c95d32f4..e3fcdde4 100644
> --- a/utils/nfsd/nfsd.c
> +++ b/utils/nfsd/nfsd.c
> @@ -185,7 +185,7 @@ main(int argc, char **argv)
>  				hcounter = 0;
>  			}
>  			if (hcounter) {
> -				haddr = realloc(haddr, sizeof(char*) * hcounter+1);
> +				haddr = realloc(haddr, sizeof(char*) * (hcounter+1));
>  				if(!haddr) {
>  					fprintf(stderr, "%s: unable to allocate "
>  							"memory.\n", progname);
> -- 
> 2.33.0

A couple of notes regarding patch submission process:

You sent this To: chuck.lever and prefixed the Subject with
"nfsd:" so I assumed it was for the Linux in-kernel NFS
server. In fact, it's for nfs-utils. Steve might not
recognize that he is responsible for this patch. I suggest
using "nfs-utils:" instead for such patches (including the
preceding patch labeled "gssd:").

Second, your email transfer agent's DKIM is misconfigured.
This security feature is tested by our patch intake tooling
as a way to spot bogus submitters. b4 reported this when I
imported your patch:

  ✗ [PATCH] nfsd: fix memory overflow for haddr
    + Link: https://patch.msgid.link/356736aa-25d8-4b79-a50f-33b4e7035856@huawei.com
  ---
  ✗ BADSIG: DKIM/h-partners.com

This might become a blocking gate for future submissions, so
you should speak with your email administrator to get this
corrected.


-- 
Chuck Lever

      reply	other threads:[~2026-07-14 15:16 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14  8:43 nfsd: fix memory overflow for haddr zhangjian (CG)
2026-07-14 15:16 ` 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=dfd0efac-0d06-47f5-a9bd-04b26f4061af@app.fastmail.com \
    --to=cel@kernel.org \
    --cc=chuck.lever@oracle.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=steved@redhat.com \
    --cc=zhangjian496@huawei.com \
    /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