Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfrm: For 32/64 compatability wrt. xfrm_usersa_info

Reported by Jiri Klimes.

Fix suggested by Patrick McHardy.

Signed-off-by: David S. Miller <davem@davemloft.net>

+9 -2
+9 -2
net/xfrm/xfrm_user.c
··· 1914 1914 } 1915 1915 #endif 1916 1916 1917 + /* For the xfrm_usersa_info cases we have to work around some 32-bit vs. 1918 + * 64-bit compatability issues. On 32-bit the structure is 220 bytes, but 1919 + * for 64-bit it gets padded out to 224 bytes. Those bytes are just 1920 + * padding and don't have any content we care about. Therefore as long 1921 + * as we have enough bytes for the content we can make both cases work. 1922 + */ 1923 + 1917 1924 #define XMSGSIZE(type) sizeof(struct type) 1918 1925 1919 1926 static const int xfrm_msg_min[XFRM_NR_MSGTYPES] = { 1920 - [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), 1927 + [XFRM_MSG_NEWSA - XFRM_MSG_BASE] = 220, /* see above */ 1921 1928 [XFRM_MSG_DELSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1922 1929 [XFRM_MSG_GETSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_id), 1923 1930 [XFRM_MSG_NEWPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), ··· 1934 1927 [XFRM_MSG_ACQUIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_acquire), 1935 1928 [XFRM_MSG_EXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_expire), 1936 1929 [XFRM_MSG_UPDPOLICY - XFRM_MSG_BASE] = XMSGSIZE(xfrm_userpolicy_info), 1937 - [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_info), 1930 + [XFRM_MSG_UPDSA - XFRM_MSG_BASE] = 220, /* see above */ 1938 1931 [XFRM_MSG_POLEXPIRE - XFRM_MSG_BASE] = XMSGSIZE(xfrm_user_polexpire), 1939 1932 [XFRM_MSG_FLUSHSA - XFRM_MSG_BASE] = XMSGSIZE(xfrm_usersa_flush), 1940 1933 [XFRM_MSG_FLUSHPOLICY - XFRM_MSG_BASE] = 0,