ceph: fix unaligned access in ceph_send_cap_releases [Linux 5.2]

ceph: fix unaligned access in ceph_send_cap_releases [Linux 5.2]

This Linux kernel change "ceph: fix unaligned access in ceph_send_cap_releases" is included in the Linux 5.2 release. This change is authored by Jeff Layton <jlayton [at] kernel.org> on Thu May 2 08:06:50 2019 -0400. The commit for this change in Linux stable tree is 4198aba (patch).

ceph: fix unaligned access in ceph_send_cap_releases

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

There are 3 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 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 5f3f375..959b1bf 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);

Leave a Reply

Your email address will not be published. Required fields are marked *