[SRU B/D/E/F/focal:linux-oem-5.6 2/2] cgroup: Fix sock_cgroup_data on big-endian.

Thadeu Lima de Souza Cascardo cascardo at canonical.com
Mon Jul 27 13:28:41 UTC 2020


From: Cong Wang <xiyou.wangcong at gmail.com>

BugLink: https://bugs.launchpad.net/bugs/1886860

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 at roeck-us.net>
Signed-off-by: David S. Miller <davem at davemloft.net>
(cherry picked from commit 14b032b8f8fce03a546dcf365454bec8c4a58d7d)
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo at canonical.com>
---
 include/linux/cgroup-defs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/cgroup-defs.h b/include/linux/cgroup-defs.h
index 0ca31b362ba6..afac6c95b83f 100644
--- a/include/linux/cgroup-defs.h
+++ b/include/linux/cgroup-defs.h
@@ -762,6 +762,7 @@ struct sock_cgroup_data {
 		struct {
 			u8	is_data : 1;
 			u8	no_refcnt : 1;
+			u8	unused : 6;
 			u8	padding;
 			u16	prioidx;
 			u32	classid;
@@ -771,6 +772,7 @@ struct sock_cgroup_data {
 			u32	classid;
 			u16	prioidx;
 			u8	padding;
+			u8	unused : 6;
 			u8	no_refcnt : 1;
 			u8	is_data : 1;
 		} __packed;
-- 
2.25.1




More information about the kernel-team mailing list