]> git.baikalelectronics.ru Git - kernel.git/commit
ipv6: check sk sk_type and protocol early in ip_mroute_set/getsockopt
authorXin Long <lucien.xin@gmail.com>
Fri, 24 Feb 2017 08:29:06 +0000 (16:29 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 27 Feb 2017 02:25:46 +0000 (21:25 -0500)
commit6f7f31dbc3499599c1b105d57da1a8fa968e4712
tree473e3e941cd23e1d99b9ace71583a39182bf48e5
parent48dc6fdae08b974a10a550f30a43f66bed537ab1
ipv6: check sk sk_type and protocol early in ip_mroute_set/getsockopt

Commit 1a70c6258fb8 ("ipv4: ipmr: various fixes and cleanups") fixed
the issue for ipv4 ipmr:

  ip_mroute_setsockopt() & ip_mroute_getsockopt() should not
  access/set raw_sk(sk)->ipmr_table before making sure the socket
  is a raw socket, and protocol is IGMP

The same fix should be done for ipv6 ipmr as well.

This patch can fix the panic caused by overwriting the same offset
as ipmr_table as in raw_sk(sk) when accessing other type's socket
by ip_mroute_setsockopt().

Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv6/ip6mr.c