Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ed77de9f authored by Harald Welte's avatar Harald Welte Committed by David S. Miller
Browse files

[NETFILTER] nfnetlink: only load subsystems if CAP_NET_ADMIN is set



Without this patch, any user can cause nfnetlink subsystems to be
autoloaded.  Those subsystems however could add significant processing
overhead to packet processing, and would refuse any configuration messages
from non-CAP_NET_ADMIN processes anyway.

This patch follows a suggestion from Patrick McHardy.

Signed-off-by: default avatarHarald Welte <laforge@netfilter.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5978a9b8
Loading
Loading
Loading
Loading
+10 −7
Original line number Diff line number Diff line
@@ -240,12 +240,15 @@ static inline int nfnetlink_rcv_msg(struct sk_buff *skb,
	ss = nfnetlink_get_subsys(type);
	if (!ss) {
#ifdef CONFIG_KMOD
		if (cap_raised(NETLINK_CB(skb).eff_cap, CAP_NET_ADMIN)) {
			/* don't call nfnl_shunlock, since it would reenter
			 * with further packet processing */
			up(&nfnl_sem);
		request_module("nfnetlink-subsys-%d", NFNL_SUBSYS_ID(type));
			request_module("nfnetlink-subsys-%d",
					NFNL_SUBSYS_ID(type));
			nfnl_shlock();
			ss = nfnetlink_get_subsys(type);
		}
		if (!ss)
#endif
			goto err_inval;