net: xfrm: fix shift-out-of-bounce
authorPavel Skripkin <paskripkin@gmail.com>
Wed, 28 Jul 2021 16:38:18 +0000 (19:38 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 25 May 2022 07:17:57 +0000 (09:17 +0200)
commitab610ee1d1a1d5f9f6e326c21962cb3fc8b81a5b
tree210b2820a840c6d7d09f464b5da7217a6a371b0b
parent5b7f84b1f9f46327360a64c529433fa0d68cc3f4
net: xfrm: fix shift-out-of-bounce

[ Upstream commit 5d8dbb7fb82b8661c16d496644b931c0e2e3a12e ]

We need to check up->dirmask to avoid shift-out-of-bounce bug,
since up->dirmask comes from userspace.

Also, added XFRM_USERPOLICY_DIRMASK_MAX constant to uapi to inform
user-space that up->dirmask has maximum possible value

Fixes: 2d151d39073a ("xfrm: Add possibility to set the default to block if we have no policy")
Reported-and-tested-by: syzbot+9cd5837a045bbee5b810@syzkaller.appspotmail.com
Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/uapi/linux/xfrm.h
net/xfrm/xfrm_user.c