cgroup: Fix sock_cgroup_data on big-endian.
authorCong Wang <xiyou.wangcong@gmail.com>
Thu, 9 Jul 2020 23:28:44 +0000 (16:28 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 9 Jul 2020 23:28:44 +0000 (16:28 -0700)
In order for no_refcnt and is_data to be the lowest order two
bits in the 'val' we have to pad out the bitfield of the u8.

Fixes: ad0f75e5f57c ("cgroup: fix cgroup_sk_alloc() for sk_clone_lock()")
Reported-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/cgroup-defs.h

index 4f1cd0edc57d53436a27e779fc8f3f2c8f82b6aa..fee0b5547cd0a0e32e3b0cc713e93d225c7bda60 100644 (file)
@@ -792,6 +792,7 @@ struct sock_cgroup_data {
                struct {
                        u8      is_data : 1;
                        u8      no_refcnt : 1;
+                       u8      unused : 6;
                        u8      padding;
                        u16     prioidx;
                        u32     classid;
@@ -801,6 +802,7 @@ struct sock_cgroup_data {
                        u32     classid;
                        u16     prioidx;
                        u8      padding;
+                       u8      unused : 6;
                        u8      no_refcnt : 1;
                        u8      is_data : 1;
                } __packed;