Re: [PATCH] ceph: fix incorrectly assigning random values to peer's members

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Xiubo Li <xiubli@xxxxxxxxxx> writes:

> For export the peer is empty in ceph.
>
> URL: https://tracker.ceph.com/issues/55857
> Signed-off-by: Xiubo Li <xiubli@xxxxxxxxxx>
> ---
>  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) {
> -- 
>
> 2.36.0.rc1
>

Are you sure this isn't breaking anything?  Looking at MClientCaps.h, it
seems to be doing something similar, i.e. for the CAP_OP_EXPORT, the
'peer' is encoded where the 'size', 'max_size', 'truncate_size',...  are
for the CAP_OP_IMPORT.  This is definitely confusing and messy, but not
sure if your change isn't breaking something.

Cheers,
-- 
Luís




[Index of Archives]     [CEPH Users]     [Ceph Large]     [Ceph Dev]     [Information on CEPH]     [Linux BTRFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux