linux-brain/net/netlabel
Sean Tranchetti 1f3a236692 netlabel: check for IPV4MASK in addrinfo_get
[ Upstream commit f88b4c01b9 ]

netlbl_unlabel_addrinfo_get() assumes that if it finds the
NLBL_UNLABEL_A_IPV4ADDR attribute, it must also have the
NLBL_UNLABEL_A_IPV4MASK attribute as well. However, this is
not necessarily the case as the current checks in
netlbl_unlabel_staticadd() and friends are not sufficent to
enforce this.

If passed a netlink message with NLBL_UNLABEL_A_IPV4ADDR,
NLBL_UNLABEL_A_IPV6ADDR, and NLBL_UNLABEL_A_IPV6MASK attributes,
these functions will all call netlbl_unlabel_addrinfo_get() which
will then attempt dereference NULL when fetching the non-existent
NLBL_UNLABEL_A_IPV4MASK attribute:

Unable to handle kernel NULL pointer dereference at virtual address 0
Process unlab (pid: 31762, stack limit = 0xffffff80502d8000)
Call trace:
	netlbl_unlabel_addrinfo_get+0x44/0xd8
	netlbl_unlabel_staticremovedef+0x98/0xe0
	genl_rcv_msg+0x354/0x388
	netlink_rcv_skb+0xac/0x118
	genl_rcv+0x34/0x48
	netlink_unicast+0x158/0x1f0
	netlink_sendmsg+0x32c/0x338
	sock_sendmsg+0x44/0x60
	___sys_sendmsg+0x1d0/0x2a8
	__sys_sendmsg+0x64/0xb4
	SyS_sendmsg+0x34/0x4c
	el0_svc_naked+0x34/0x38
Code: 51001149 7100113f 540000a0 f9401508 (79400108)
---[ end trace f6438a488e737143 ]---
Kernel panic - not syncing: Fatal exception

Signed-off-by: Sean Tranchetti <stranche@codeaurora.org>

Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-20 09:52:36 +02:00
..
Kconfig [NETLABEL]: Fix build failure. 2006-11-05 16:44:06 -08:00
Makefile doc: Update the email address for Paul Moore in various source files 2011-08-01 17:58:33 -07:00
netlabel_addrlist.c netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_addrlist.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_cipso_v4.c netlabel: Deletion of an unnecessary check before the function call "cipso_v4_doi_free" 2015-02-03 16:22:12 -08:00
netlabel_cipso_v4.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_domainhash.c netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_domainhash.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_kapi.c netlabel: add address family checks to netlbl_{sock,req}_delattr() 2016-08-20 18:09:22 +02:00
netlabel_mgmt.c netlink: implement nla_put_in_addr and nla_put_in6_addr 2015-03-31 13:58:35 -04:00
netlabel_mgmt.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_unlabeled.c netlabel: check for IPV4MASK in addrinfo_get 2018-10-20 09:52:36 +02:00
netlabel_unlabeled.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00
netlabel_user.c netlabel: directly return netlbl_unlabel_genl_init() 2014-10-08 16:08:04 -04:00
netlabel_user.h netlabel: Fix FSF address in file headers 2013-12-06 12:37:56 -05:00