https://github.com/torvalds/linux
Revision 75caf310d16cc5e2f851c048cd597f5437013368 authored by Linus Torvalds on 28 May 2020, 20:04:25 UTC, committed by Linus Torvalds on 28 May 2020, 20:04:25 UTC
Merge misc fixes from Andrew Morton:
 "5 fixes"

* emailed patches from Andrew Morton <akpm@linux-foundation.org>:
  include/asm-generic/topology.h: guard cpumask_of_node() macro argument
  fs/binfmt_elf.c: allocate initialized memory in fill_thread_core_info()
  mm: remove VM_BUG_ON(PageSlab()) from page_mapcount()
  mm,thp: stop leaking unreleased file pages
  mm/z3fold: silence kmemleak false positives of slots
2 parent s d16eea2 + 4377748
Raw File
Tip revision: 75caf310d16cc5e2f851c048cd597f5437013368 authored by Linus Torvalds on 28 May 2020, 20:04:25 UTC
Merge branch 'akpm' (patches from Andrew)
Tip revision: 75caf31
netlink.c
// SPDX-License-Identifier: GPL-2.0-only
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <linux/types.h>
#include <net/net_namespace.h>
#include <net/netlink.h>
#include <linux/in6.h>
#include <net/ip.h>

int rtm_getroute_parse_ip_proto(struct nlattr *attr, u8 *ip_proto, u8 family,
				struct netlink_ext_ack *extack)
{
	*ip_proto = nla_get_u8(attr);

	switch (*ip_proto) {
	case IPPROTO_TCP:
	case IPPROTO_UDP:
		return 0;
	case IPPROTO_ICMP:
		if (family != AF_INET)
			break;
		return 0;
#if IS_ENABLED(CONFIG_IPV6)
	case IPPROTO_ICMPV6:
		if (family != AF_INET6)
			break;
		return 0;
#endif
	}
	NL_SET_ERR_MSG(extack, "Unsupported ip proto");
	return -EOPNOTSUPP;
}
EXPORT_SYMBOL_GPL(rtm_getroute_parse_ip_proto);
back to top