]> git.baikalelectronics.ru Git - kernel.git/commit
smack: Check address length before reading address family
authorTetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fri, 12 Apr 2019 10:59:35 +0000 (19:59 +0900)
committerCasey Schaufler <casey@schaufler-ca.com>
Tue, 30 Apr 2019 00:32:27 +0000 (17:32 -0700)
commitbacba6730f0b0035fff5f0a74e2c2283306bcbe6
treed168ccc0225f3ab3fd890a893a5813dfd4f27065
parentc23ae7740495d10dd199953fec48da16c1df85b3
smack: Check address length before reading address family

KMSAN will complain if valid address length passed to bind()/connect()/
sendmsg() is shorter than sizeof("struct sockaddr"->sa_family) bytes.

Also, since smk_ipv6_port_label()/smack_netlabel_send()/
smack_ipv6host_label()/smk_ipv6_check()/smk_ipv6_port_check() are not
checking valid address length and/or address family, make sure we check
both. The minimal valid length in smack_socket_connect() is changed from
sizeof(struct sockaddr_in6) bytes to SIN6_LEN_RFC2133 bytes, for it seems
that Smack is not using "struct sockaddr_in6"->sin6_scope_id field.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Signed-off-by: Casey Schaufler <casey@schaufler-ca.com>
security/smack/smack_lsm.c