From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Anirudh Gupta <anirudhrudr@gmail.com>,
Anirudh Gupta <anirudh.gupta@sophos.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Steffen Klassert <steffen.klassert@secunet.com>,
Sasha Levin <sashal@kernel.org>,
netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 5.1 036/219] xfrm: Fix xfrm sel prefix length validation
Date: Mon, 15 Jul 2019 10:00:37 -0400 [thread overview]
Message-ID: <20190715140341.6443-36-sashal@kernel.org> (raw)
In-Reply-To: <20190715140341.6443-1-sashal@kernel.org>
From: Anirudh Gupta <anirudhrudr@gmail.com>
[ Upstream commit b38ff4075a80b4da5cb2202d7965332ca0efb213 ]
Family of src/dst can be different from family of selector src/dst.
Use xfrm selector family to validate address prefix length,
while verifying new sa from userspace.
Validated patch with this command:
ip xfrm state add src 1.1.6.1 dst 1.1.6.2 proto esp spi 4260196 \
reqid 20004 mode tunnel aead "rfc4106(gcm(aes))" \
0x1111016400000000000000000000000044440001 128 \
sel src 1011:1:4::2/128 sel dst 1021:1:4::2/128 dev Port5
Fixes: 07bf7908950a ("xfrm: Validate address prefix lengths in the xfrm selector.")
Signed-off-by: Anirudh Gupta <anirudh.gupta@sophos.com>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/xfrm/xfrm_user.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c
index 6916931b1de1..ee91f939903e 100644
--- a/net/xfrm/xfrm_user.c
+++ b/net/xfrm/xfrm_user.c
@@ -150,6 +150,22 @@ static int verify_newsa_info(struct xfrm_usersa_info *p,
err = -EINVAL;
switch (p->family) {
+ case AF_INET:
+ break;
+
+ case AF_INET6:
+#if IS_ENABLED(CONFIG_IPV6)
+ break;
+#else
+ err = -EAFNOSUPPORT;
+ goto out;
+#endif
+
+ default:
+ goto out;
+ }
+
+ switch (p->sel.family) {
case AF_INET:
if (p->sel.prefixlen_d > 32 || p->sel.prefixlen_s > 32)
goto out;
--
2.20.1
next prev parent reply other threads:[~2019-07-15 14:05 UTC|newest]
Thread overview: 95+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-15 14:00 [PATCH AUTOSEL 5.1 001/219] ath10k: Check tx_stats before use it Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 002/219] ath10k: htt: don't use txdone_fifo with SDIO Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 003/219] ath10k: fix incorrect multicast/broadcast rate setting Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 004/219] ath9k: Don't trust TX status TID number when reporting airtime Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 005/219] wil6210: fix potential out-of-bounds read Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 006/219] ath10k: Do not send probe response template for mesh Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 008/219] ath9k: Check for errors when reading SREV register Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 009/219] ath10k: Fix the wrong value of enums for wmi tlv stats id Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 010/219] wil6210: fix missed MISC mbox interrupt Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 011/219] ath6kl: add some bounds checking Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 012/219] ath10k: add peer id check in ath10k_peer_find_by_id Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 014/219] wil6210: fix spurious interrupts in 3-msi Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 015/219] ath: DFS JP domain W56 fixed pulse type 3 RADAR detection Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 016/219] ath10k: Fix encoding for protected management frames Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 018/219] batman-adv: fix for leaked TVLV handler Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 028/219] net: stmmac: dwmac1000: Clear unused address entries Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 029/219] net: stmmac: dwmac4/5: " Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 030/219] net: stmmac: Prevent missing interrupts when running NAPI Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 031/219] net: hns3: initialize CPU reverse mapping Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 032/219] qed: Set the doorbell address correctly Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 035/219] af_key: fix leaks in key_pol_get_resp and dump_sp Sasha Levin
2019-07-15 14:00 ` Sasha Levin [this message]
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 042/219] Revert "e1000e: fix cyclic resets at link up with active tx" Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 043/219] e1000e: start network tx queue only when link is up Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 047/219] net: phy: Check against net_device being NULL Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 051/219] batman-adv: Fix duplicated OGMs on NETDEV_UP Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 055/219] net: hns3: add a check to pointer in error_detected and slot_reset Sasha Levin
2019-07-15 14:00 ` [PATCH AUTOSEL 5.1 056/219] net: hns3: set ops to null when unregister ad_dev Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 062/219] net: stmmac: dwmac4: fix flow control issue Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 063/219] net: stmmac: modify default value of tx-frames Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 065/219] net: fec: Do not use netdev messages too early Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 066/219] net: axienet: Fix race condition causing TX hang Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 069/219] net: sfp: add mutex to prevent concurrent state checks Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 070/219] ipset: Fix memory accounting for hash types on resize Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 083/219] bpf: silence warning messages in core Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 091/219] qed: iWARP - Fix tc for MPA ll2 connection Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 092/219] net: hns3: fix for dereferencing before null checking Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 093/219] net: hns3: fix for skb leak when doing selftest Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 094/219] net: hns3: delay ring buffer clearing during reset Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 097/219] xfrm: fix sa selector validation Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 105/219] vhost_net: disable zerocopy by default Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 106/219] iavf: allow null RX descriptors Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 109/219] bpf: fix callees pruning callers Sasha Levin
2019-07-15 14:01 ` [PATCH AUTOSEL 5.1 111/219] net: netsec: initialize tx ring on ndo_open Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 124/219] ipsec: select crypto ciphers for xfrm_algo Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 125/219] ipvs: defer hook registration to avoid leaks Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 138/219] net: stmmac: sun8i: force select external PHY when no internal one Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 139/219] rtlwifi: rtl8192cu: fix error handle when usb probe failed Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 140/219] mt7601u: do not schedule rx_tasklet when the device has been disconnected Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 142/219] mt7601u: fix possible memory leak when the device is disconnected Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 143/219] ipvs: fix tinfo memory leak in start_sync_thread Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 144/219] ath10k: add missing error handling Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 145/219] ath10k: fix fw crash by moving chip reset after napi disabled Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 146/219] ath10k: fix PCIE device wake up failed Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 153/219] netfilter: ctnetlink: Fix regression in conntrack entry deletion Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 154/219] xsk: Properly terminate assignment in xskq_produce_flush_desc Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 156/219] bpf: fix BPF_ALU32 | BPF_ARSH on BE arches Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 159/219] net/mlx5: Get vport ACL namespace by vport index Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 160/219] ixgbe: Check DDM existence in transceiver before access Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 164/219] ath9k: correctly handle short radar pulses Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 165/219] wil6210: drop old event after wmi_call timeout Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 173/219] net: hns3: fix a -Wformat-nonliteral compile warning Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 174/219] net: hns3: add some error checking in hclge_tm module Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 175/219] ath10k: Fix memory leak in qmi Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 176/219] ath10k: destroy sdio workqueue while remove sdio module Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 177/219] net: mvpp2: prs: Don't override the sign bit in SRAM parser shift Sasha Levin
2019-07-15 14:02 ` [PATCH AUTOSEL 5.1 178/219] igb: clear out skb->tstamp after reading the txtime Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 179/219] net: hns3: add Asym Pause support to fix autoneg problem Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 180/219] ixgbe: Avoid NULL pointer dereference with VF on non-IPsec hw Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 181/219] iwlwifi: mvm: Drop large non sta frames Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 182/219] bpf: fix uapi bpf_prog_info fields alignment Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 183/219] netfilter: Fix remainder of pseudo-header protocol 0 Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 184/219] iwlwifi: dbg: fix debug monitor stop and restart delays Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 185/219] bnxt_en: Disable bus master during PCI shutdown and driver unload Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 186/219] bnxt_en: Fix statistics context reservation logic for RDMA driver Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 192/219] vxlan: do not destroy fdb if register_netdevice() is failed Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 193/219] bnx2x: Prevent ptp_task to be rescheduled indefinitely Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 194/219] net: usb: asix: init MAC address buffers Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 196/219] libbpf: fix GCC8 warning for strncpy Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 197/219] bpf, libbpf, smatch: Fix potential NULL pointer dereference Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 198/219] selftests: bpf: fix inlines in test_lwt_seg6local Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 199/219] bonding: validate ip header before check IPPROTO_IGMP Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 202/219] tools: bpftool: Fix json dump crash on powerpc Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 203/219] net: hns3: enable broadcast promisc mode when initializing VF Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 207/219] Bluetooth: 6lowpan: search for destination address in all peers Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 210/219] Bluetooth: Check state in l2cap_disconnect_rsp Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 211/219] Bluetooth: hidp: NUL terminate a string in the compat ioctl Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 212/219] gtp: add missing gtp_encap_disable_sock() in gtp_encap_enable() Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 213/219] Bluetooth: validate BLE connection interval updates Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 214/219] gtp: fix suspicious RCU usage Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 215/219] gtp: fix Illegal context switch in RCU read-side critical section Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 216/219] gtp: fix use-after-free in gtp_encap_destroy() Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 217/219] gtp: fix use-after-free in gtp_newlink() Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 218/219] xdp: fix race on generic receive path Sasha Levin
2019-07-15 14:03 ` [PATCH AUTOSEL 5.1 219/219] net: mvmdio: defer probe of orion-mdio if a clock is not ready Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190715140341.6443-36-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=anirudh.gupta@sophos.com \
--cc=anirudhrudr@gmail.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=steffen.klassert@secunet.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).