Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: ChenXiaoSong <chenxiaosong@chenxiaosong.com>
Cc: smfrench@gmail.com, linkinjeon@kernel.org, pc@manguebit.org,
	ronniesahlberg@gmail.com, sprasad@microsoft.com, tom@talpey.com,
	bharathsm@microsoft.com, senozhatsky@chromium.org,
	dhowells@redhat.com, metze@samba.org, gael.blivet@gmail.com,
	linux-cifs@vger.kernel.org,
	ChenXiaoSong <chenxiaosong@kylinos.cn>
Subject: Re: [PATCH v2 1/3] smb/server: fix signing when a response uses more than one iov
Date: Thu, 16 Jul 2026 23:24:25 +0300	[thread overview]
Message-ID: <alk9-WOWQeHaq0wV@ashevche-desk.local> (raw)
In-Reply-To: <20260716001156.671587-2-chenxiaosong@chenxiaosong.com>

On Thu, Jul 16, 2026 at 12:11:54AM +0000, ChenXiaoSong wrote:

> Some SMB responses keep their data in another buffer. The SMB header
> and the data are then in different iovs.
> 
> The old code only handled this for SMB2 READ. For other commands, it
> signed only the last iov. QUERY_INFO and CHANGE_NOTIFY can also use
> another iov for their data. Their SMB header was not signed, so Windows
> will client rejected the response.
> 
> Find the iov that starts with the current SMB header. Sign this iov and
> all iovs after it.

...

> +static struct kvec *smb2_get_sign_rsp_iov(struct ksmbd_work *work,
> +					   struct smb2_hdr *hdr, int *n_vec)
> +{

> +	int i;

This is not addressed, why?

> +	/*
> +	 * iov[0] has the RFC1002 message length. It is not part of the SMB2
> +	 * message, so do not sign it.
> +	 */
> +	for (i = 1; i <= work->iov_idx; i++) {
> +		if (work->iov[i].iov_base == hdr) {
> +			*n_vec = work->iov_idx - i + 1;
> +			return &work->iov[i];
> +		}
> +	}
> +
> +	WARN_ON_ONCE(work->iov_idx < 1 ||
> +		     work->iov[work->iov_idx].iov_base != hdr);

The second part of this check is basically always true. What's the point?

> +	*n_vec = 1;
> +	return &work->iov[work->iov_idx];
> +}

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-07-16 20:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-16  0:11 [PATCH v2 0/3] smb/server: fix some bugs in preparation for change notify support ChenXiaoSong
2026-07-16  0:11 ` [PATCH v2 1/3] smb/server: fix signing when a response uses more than one iov ChenXiaoSong
2026-07-16 20:24   ` Andy Shevchenko [this message]
2026-07-16 23:43     ` ChenXiaoSong
2026-07-17  8:03       ` Andy Shevchenko
2026-07-17  8:58         ` ChenXiaoSong
2026-07-16  0:11 ` [PATCH v2 2/3] smb/server: cancel async requests when closing connection ChenXiaoSong
2026-07-16  2:13   ` Namjae Jeon
2026-07-16  2:27     ` ChenXiaoSong
2026-07-16  0:11 ` [PATCH v2 3/3] smb/server: stop new async work " ChenXiaoSong
2026-07-16  2:25   ` Namjae Jeon
2026-07-16  2:33     ` ChenXiaoSong

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=alk9-WOWQeHaq0wV@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=bharathsm@microsoft.com \
    --cc=chenxiaosong@chenxiaosong.com \
    --cc=chenxiaosong@kylinos.cn \
    --cc=dhowells@redhat.com \
    --cc=gael.blivet@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=metze@samba.org \
    --cc=pc@manguebit.org \
    --cc=ronniesahlberg@gmail.com \
    --cc=senozhatsky@chromium.org \
    --cc=smfrench@gmail.com \
    --cc=sprasad@microsoft.com \
    --cc=tom@talpey.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