[v2,3/3] ceph: fix unaligned access in ceph_send_cap_releases
diff mbox series

Message ID 20190502184638.3614-3-jlayton@kernel.org
State New
Headers show
Series
  • [v2,1/3] libceph: fix unaligned accesses in ceph_entity_addr handling
Related show

Commit Message

Jeff Layton May 2, 2019, 6:46 p.m. UTC
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
 fs/ceph/mds_client.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Yan, Zheng May 5, 2019, 7:44 a.m. UTC | #1
On Fri, May 3, 2019 at 2:50 AM Jeff Layton <jlayton@kernel.org> wrote:
>
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>  fs/ceph/mds_client.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
> index e09773a7a9cf..66eae336a68a 100644
> --- a/fs/ceph/mds_client.c
> +++ b/fs/ceph/mds_client.c
> @@ -1855,7 +1855,8 @@ static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
>                 num_cap_releases--;
>
>                 head = msg->front.iov_base;
> -               le32_add_cpu(&head->num, 1);
> +               put_unaligned_le32(get_unaligned_le32(&head->num) + 1,
> +                                  &head->num);
>                 item = msg->front.iov_base + msg->front.iov_len;
>                 item->ino = cpu_to_le64(cap->cap_ino);
>                 item->cap_id = cpu_to_le64(cap->cap_id);
> --
> 2.21.0
>

Reviewed-by: "Yan, Zheng" <zyan@redhat.com

Patch
diff mbox series

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index e09773a7a9cf..66eae336a68a 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -1855,7 +1855,8 @@  static void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
 		num_cap_releases--;
 
 		head = msg->front.iov_base;
-		le32_add_cpu(&head->num, 1);
+		put_unaligned_le32(get_unaligned_le32(&head->num) + 1,
+				   &head->num);
 		item = msg->front.iov_base + msg->front.iov_len;
 		item->ino = cpu_to_le64(cap->cap_ino);
 		item->cap_id = cpu_to_le64(cap->cap_id);