From: Jeff Layton <jlayton@kernel.org>
To: Xiubo Li <xiubli@redhat.com>, idryomov@gmail.com
Cc: vshankar@redhat.com, ceph-devel@vger.kernel.org,
ukernel <ukernel@gmail.com>
Subject: Re: [PATCH] ceph: fix incorrectly assigning random values to peer's members
Date: Mon, 06 Jun 2022 06:23:16 -0400 [thread overview]
Message-ID: <a60d5c710b68a7fff35113df0fac754d199db075.camel@kernel.org> (raw)
In-Reply-To: <20220606072835.302935-1-xiubli@redhat.com>
On Mon, 2022-06-06 at 15:28 +0800, Xiubo Li wrote:
> For export the peer is empty in ceph.
>
> URL: https://tracker.ceph.com/issues/55857
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> ---
> fs/ceph/caps.c | 15 +++++----------
> 1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
> index 0a48bf829671..8efa46ff4282 100644
> --- a/fs/ceph/caps.c
> +++ b/fs/ceph/caps.c
> @@ -4127,16 +4127,11 @@ void ceph_handle_caps(struct ceph_mds_session *session,
> p += flock_len;
> }
>
> - if (msg_version >= 3) {
> - if (op == CEPH_CAP_OP_IMPORT) {
> - if (p + sizeof(*peer) > end)
> - goto bad;
> - peer = p;
> - p += sizeof(*peer);
> - } else if (op == CEPH_CAP_OP_EXPORT) {
> - /* recorded in unused fields */
> - peer = (void *)&h->size;
> - }
> + if (msg_version >= 3 && op == CEPH_CAP_OP_IMPORT) {
> + if (p + sizeof(*peer) > end)
> + goto bad;
> + peer = p;
> + p += sizeof(*peer);
> }
>
> if (msg_version >= 4) {
This was added in commit 11df2dfb61 (ceph: add imported caps when
handling cap export message). If peer should always be NULL on an
export, I wonder what he was thinking by adding this in the first place?
Zheng, could you take a look here?
If this does turn out to be correct, then I think there is some further
cleanup you can do here, as you should be able to drop the peer argument
from handle_cap_export. That should also collapse some of the code down
in that function as well since lot of the target fields end up being 0s.
--
Jeff Layton <jlayton@kernel.org>
next prev parent reply other threads:[~2022-06-06 10:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-06 7:28 [PATCH] ceph: fix incorrectly assigning random values to peer's members Xiubo Li
2022-06-06 10:13 ` Luís Henriques
2022-06-06 10:23 ` Jeff Layton [this message]
2022-06-06 11:48 ` Xiubo Li
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=a60d5c710b68a7fff35113df0fac754d199db075.camel@kernel.org \
--to=jlayton@kernel.org \
--cc=ceph-devel@vger.kernel.org \
--cc=idryomov@gmail.com \
--cc=ukernel@gmail.com \
--cc=vshankar@redhat.com \
--cc=xiubli@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.