ceph: fix message length computation
diff mbox

Message ID 9959810.KasB66Ks40@wuerfel
State New
Headers show

Commit Message

Arnd Bergmann Sept. 30, 2015, 1:04 p.m. UTC
create_request_message() computes the maximum length of a message,
but uses the wrong type for the time stamp: sizeof(struct timespec)
may be 8 or 16 depending on the architecture, while sizeof(struct
ceph_timespec) is always 8, and that is what gets put into the
message.

Found while auditing the uses of timespec for y2038 problems.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: b8e69066d8af ("ceph: include time stamp in every MDS request")
---

--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Yan, Zheng Oct. 1, 2015, 1:40 p.m. UTC | #1
On Wed, Sep 30, 2015 at 9:04 PM, Arnd Bergmann <arnd@arndb.de> wrote:
> create_request_message() computes the maximum length of a message,
> but uses the wrong type for the time stamp: sizeof(struct timespec)
> may be 8 or 16 depending on the architecture, while sizeof(struct
> ceph_timespec) is always 8, and that is what gets put into the
> message.
>
> Found while auditing the uses of timespec for y2038 problems.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: b8e69066d8af ("ceph: include time stamp in every MDS request")
> ---
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index 51cb02da75d9..fe2c982764e7 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1935,7 +1935,7 @@ static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
>
>         len = sizeof(*head) +
>                 pathlen1 + pathlen2 + 2*(1 + sizeof(u32) + sizeof(u64)) +
> -               sizeof(struct timespec);
> +               sizeof(struct ceph_timespec);
>
>         /* calculate (max) length for cap releases */
>         len += sizeof(struct ceph_mds_request_release) *
>

Applied. thanks

Yan, Zheng

> --
> To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe ceph-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch
diff mbox

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index 51cb02da75d9..fe2c982764e7 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1935,7 +1935,7 @@  static struct ceph_msg *create_request_message(struct ceph_mds_client *mdsc,
 
 	len = sizeof(*head) +
 		pathlen1 + pathlen2 + 2*(1 + sizeof(u32) + sizeof(u64)) +
-		sizeof(struct timespec);
+		sizeof(struct ceph_timespec);
 
 	/* calculate (max) length for cap releases */
 	len += sizeof(struct ceph_mds_request_release) *