Merge 5.10.107 into android12-5.10-lts
Changes in 5.10.107 Revert "xfrm: state and policy should fail if XFRMA_IF_ID 0" sctp: fix the processing for INIT chunk xfrm: Check if_id in xfrm_migrate xfrm: Fix xfrm migrate issues when address family changes arm64: dts: rockchip: fix rk3399-puma eMMC HS400 signal integrity arm64: dts: rockchip: reorder rk3399 hdmi clocks arm64: dts: agilex: use the compatible "intel,socfpga-agilex-hsotg" ARM: dts: rockchip: reorder rk322x hmdi clocks ARM: dts: rockchip: fix a typo on rk3288 crypto-controller mac80211: refuse aggregations sessions before authorized MIPS: smp: fill in sibling and core maps earlier ARM: 9178/1: fix unmet dependency on BITREVERSE for HAVE_ARCH_BITREVERSE can: rcar_canfd: rcar_canfd_channel_probe(): register the CAN device when fully ready atm: firestream: check the return value of ioremap() in fs_init() iwlwifi: don't advertise TWT support drm/vrr: Set VRR capable prop only if it is attached to connector nl80211: Update bss channel on channel switch for P2P_CLIENT tcp: make tcp_read_sock() more robust sfc: extend the locking on mcdi->seqno kselftest/vm: fix tests build with old libc io_uring: return back safer resurrect arm64: kvm: Fix copy-and-paste error in bhb templates for v5.10 stable Linux 5.10.107 Signed-off-by: Greg Kroah-Hartman <gregkh@google.com> Change-Id: I9775c8530d22ce5493bf7d83503640acf704b848
This commit is contained in:
2
Makefile
2
Makefile
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
VERSION = 5
|
||||
PATCHLEVEL = 10
|
||||
SUBLEVEL = 106
|
||||
SUBLEVEL = 107
|
||||
EXTRAVERSION =
|
||||
NAME = Dare mighty things
|
||||
|
||||
|
@@ -640,8 +640,8 @@
|
||||
interrupts = <GIC_SPI 35 IRQ_TYPE_LEVEL_HIGH>;
|
||||
assigned-clocks = <&cru SCLK_HDMI_PHY>;
|
||||
assigned-clock-parents = <&hdmi_phy>;
|
||||
clocks = <&cru SCLK_HDMI_HDCP>, <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_CEC>;
|
||||
clock-names = "isfr", "iahb", "cec";
|
||||
clocks = <&cru PCLK_HDMI_CTRL>, <&cru SCLK_HDMI_HDCP>, <&cru SCLK_HDMI_CEC>;
|
||||
clock-names = "iahb", "isfr", "cec";
|
||||
pinctrl-names = "default";
|
||||
pinctrl-0 = <&hdmii2c_xfer &hdmi_hpd &hdmi_cec>;
|
||||
resets = <&cru SRST_HDMI_P>;
|
||||
|
@@ -990,7 +990,7 @@
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
crypto: cypto-controller@ff8a0000 {
|
||||
crypto: crypto@ff8a0000 {
|
||||
compatible = "rockchip,rk3288-crypto";
|
||||
reg = <0x0 0xff8a0000 0x0 0x4000>;
|
||||
interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
|
||||
|
@@ -476,7 +476,7 @@
|
||||
};
|
||||
|
||||
usb0: usb@ffb00000 {
|
||||
compatible = "snps,dwc2";
|
||||
compatible = "intel,socfpga-agilex-hsotg", "snps,dwc2";
|
||||
reg = <0xffb00000 0x40000>;
|
||||
interrupts = <0 93 4>;
|
||||
phys = <&usbphy0>;
|
||||
@@ -489,7 +489,7 @@
|
||||
};
|
||||
|
||||
usb1: usb@ffb40000 {
|
||||
compatible = "snps,dwc2";
|
||||
compatible = "intel,socfpga-agilex-hsotg", "snps,dwc2";
|
||||
reg = <0xffb40000 0x40000>;
|
||||
interrupts = <0 94 4>;
|
||||
phys = <&usbphy0>;
|
||||
|
@@ -472,6 +472,12 @@
|
||||
};
|
||||
|
||||
&sdhci {
|
||||
/*
|
||||
* Signal integrity isn't great at 200MHz but 100MHz has proven stable
|
||||
* enough.
|
||||
*/
|
||||
max-frequency = <100000000>;
|
||||
|
||||
bus-width = <8>;
|
||||
mmc-hs400-1_8v;
|
||||
mmc-hs400-enhanced-strobe;
|
||||
|
@@ -1770,10 +1770,10 @@
|
||||
interrupts = <GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH 0>;
|
||||
clocks = <&cru PCLK_HDMI_CTRL>,
|
||||
<&cru SCLK_HDMI_SFR>,
|
||||
<&cru PLL_VPLL>,
|
||||
<&cru SCLK_HDMI_CEC>,
|
||||
<&cru PCLK_VIO_GRF>,
|
||||
<&cru SCLK_HDMI_CEC>;
|
||||
clock-names = "iahb", "isfr", "vpll", "grf", "cec";
|
||||
<&cru PLL_VPLL>;
|
||||
clock-names = "iahb", "isfr", "cec", "grf", "vpll";
|
||||
power-domains = <&power RK3399_PD_HDCP>;
|
||||
reg-io-width = <4>;
|
||||
rockchip,grf = <&grf>;
|
||||
|
@@ -351,6 +351,9 @@ asmlinkage void start_secondary(void)
|
||||
cpu = smp_processor_id();
|
||||
cpu_data[cpu].udelay_val = loops_per_jiffy;
|
||||
|
||||
set_cpu_sibling_map(cpu);
|
||||
set_cpu_core_map(cpu);
|
||||
|
||||
cpumask_set_cpu(cpu, &cpu_coherent_mask);
|
||||
notify_cpu_starting(cpu);
|
||||
|
||||
@@ -362,9 +365,6 @@ asmlinkage void start_secondary(void)
|
||||
/* The CPU is running and counters synchronised, now mark it online */
|
||||
set_cpu_online(cpu, true);
|
||||
|
||||
set_cpu_sibling_map(cpu);
|
||||
set_cpu_core_map(cpu);
|
||||
|
||||
calculate_cpu_foreign_map();
|
||||
|
||||
/*
|
||||
|
@@ -1675,6 +1675,8 @@ static int fs_init(struct fs_dev *dev)
|
||||
dev->hw_base = pci_resource_start(pci_dev, 0);
|
||||
|
||||
dev->base = ioremap(dev->hw_base, 0x1000);
|
||||
if (!dev->base)
|
||||
return 1;
|
||||
|
||||
reset_chip (dev);
|
||||
|
||||
|
@@ -2155,6 +2155,9 @@ EXPORT_SYMBOL(drm_connector_attach_max_bpc_property);
|
||||
void drm_connector_set_vrr_capable_property(
|
||||
struct drm_connector *connector, bool capable)
|
||||
{
|
||||
if (!connector->vrr_capable_property)
|
||||
return;
|
||||
|
||||
drm_object_property_set_value(&connector->base,
|
||||
connector->vrr_capable_property,
|
||||
capable);
|
||||
|
@@ -1598,15 +1598,15 @@ static int rcar_canfd_channel_probe(struct rcar_canfd_global *gpriv, u32 ch,
|
||||
|
||||
netif_napi_add(ndev, &priv->napi, rcar_canfd_rx_poll,
|
||||
RCANFD_NAPI_WEIGHT);
|
||||
spin_lock_init(&priv->tx_lock);
|
||||
devm_can_led_init(ndev);
|
||||
gpriv->ch[priv->channel] = priv;
|
||||
err = register_candev(ndev);
|
||||
if (err) {
|
||||
dev_err(&pdev->dev,
|
||||
"register_candev() failed, error %d\n", err);
|
||||
goto fail_candev;
|
||||
}
|
||||
spin_lock_init(&priv->tx_lock);
|
||||
devm_can_led_init(ndev);
|
||||
gpriv->ch[priv->channel] = priv;
|
||||
dev_info(&pdev->dev, "device registered (channel %u)\n", priv->channel);
|
||||
return 0;
|
||||
|
||||
|
@@ -163,9 +163,9 @@ static void efx_mcdi_send_request(struct efx_nic *efx, unsigned cmd,
|
||||
/* Serialise with efx_mcdi_ev_cpl() and efx_mcdi_ev_death() */
|
||||
spin_lock_bh(&mcdi->iface_lock);
|
||||
++mcdi->seqno;
|
||||
seqno = mcdi->seqno & SEQ_MASK;
|
||||
spin_unlock_bh(&mcdi->iface_lock);
|
||||
|
||||
seqno = mcdi->seqno & SEQ_MASK;
|
||||
xflags = 0;
|
||||
if (mcdi->mode == MCDI_MODE_EVENTS)
|
||||
xflags |= MCDI_HEADER_XFLAGS_EVREQ;
|
||||
|
@@ -587,8 +587,7 @@ static struct ieee80211_sband_iftype_data iwl_he_capa[] = {
|
||||
.has_he = true,
|
||||
.he_cap_elem = {
|
||||
.mac_cap_info[0] =
|
||||
IEEE80211_HE_MAC_CAP0_HTC_HE |
|
||||
IEEE80211_HE_MAC_CAP0_TWT_REQ,
|
||||
IEEE80211_HE_MAC_CAP0_HTC_HE,
|
||||
.mac_cap_info[1] =
|
||||
IEEE80211_HE_MAC_CAP1_TF_MAC_PAD_DUR_16US |
|
||||
IEEE80211_HE_MAC_CAP1_MULTI_TID_AGG_RX_QOS_8,
|
||||
|
@@ -350,7 +350,6 @@ static const u8 he_if_types_ext_capa_sta[] = {
|
||||
[0] = WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING,
|
||||
[2] = WLAN_EXT_CAPA3_MULTI_BSSID_SUPPORT,
|
||||
[7] = WLAN_EXT_CAPA8_OPMODE_NOTIF,
|
||||
[9] = WLAN_EXT_CAPA10_TWT_REQUESTER_SUPPORT,
|
||||
};
|
||||
|
||||
static const struct wiphy_iftype_ext_capab he_iftypes_ext_capa[] = {
|
||||
|
@@ -1009,6 +1009,18 @@ static inline bool __io_match_files(struct io_kiocb *req,
|
||||
req->work.identity->files == files;
|
||||
}
|
||||
|
||||
static void io_refs_resurrect(struct percpu_ref *ref, struct completion *compl)
|
||||
{
|
||||
bool got = percpu_ref_tryget(ref);
|
||||
|
||||
/* already at zero, wait for ->release() */
|
||||
if (!got)
|
||||
wait_for_completion(compl);
|
||||
percpu_ref_resurrect(ref);
|
||||
if (got)
|
||||
percpu_ref_put(ref);
|
||||
}
|
||||
|
||||
static bool io_match_task(struct io_kiocb *head,
|
||||
struct task_struct *task,
|
||||
struct files_struct *files)
|
||||
@@ -9757,12 +9769,11 @@ static int __io_uring_register(struct io_ring_ctx *ctx, unsigned opcode,
|
||||
if (ret < 0)
|
||||
break;
|
||||
} while (1);
|
||||
|
||||
mutex_lock(&ctx->uring_lock);
|
||||
|
||||
if (ret) {
|
||||
percpu_ref_resurrect(&ctx->refs);
|
||||
goto out_quiesce;
|
||||
io_refs_resurrect(&ctx->refs, &ctx->ref_comp);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9855,7 +9866,6 @@ out:
|
||||
if (io_register_op_must_quiesce(opcode)) {
|
||||
/* bring the ctx back to life */
|
||||
percpu_ref_reinit(&ctx->refs);
|
||||
out_quiesce:
|
||||
reinit_completion(&ctx->ref_comp);
|
||||
}
|
||||
return ret;
|
||||
|
@@ -1661,14 +1661,15 @@ int km_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
||||
const struct xfrm_migrate *m, int num_bundles,
|
||||
const struct xfrm_kmaddress *k,
|
||||
const struct xfrm_encap_tmpl *encap);
|
||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net);
|
||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net,
|
||||
u32 if_id);
|
||||
struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
|
||||
struct xfrm_migrate *m,
|
||||
struct xfrm_encap_tmpl *encap);
|
||||
int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
||||
struct xfrm_migrate *m, int num_bundles,
|
||||
struct xfrm_kmaddress *k, struct net *net,
|
||||
struct xfrm_encap_tmpl *encap);
|
||||
struct xfrm_encap_tmpl *encap, u32 if_id);
|
||||
#endif
|
||||
|
||||
int km_new_mapping(struct xfrm_state *x, xfrm_address_t *ipaddr, __be16 sport);
|
||||
|
@@ -45,7 +45,6 @@ config BITREVERSE
|
||||
config HAVE_ARCH_BITREVERSE
|
||||
bool
|
||||
default n
|
||||
depends on BITREVERSE
|
||||
help
|
||||
This option enables the use of hardware bit-reversal instructions on
|
||||
architectures which support such operations.
|
||||
|
@@ -1655,11 +1655,13 @@ int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
|
||||
if (!copied)
|
||||
copied = used;
|
||||
break;
|
||||
} else if (used <= len) {
|
||||
seq += used;
|
||||
copied += used;
|
||||
offset += used;
|
||||
}
|
||||
if (WARN_ON_ONCE(used > len))
|
||||
used = len;
|
||||
seq += used;
|
||||
copied += used;
|
||||
offset += used;
|
||||
|
||||
/* If recv_actor drops the lock (e.g. TCP splice
|
||||
* receive) the skb pointer might be invalid when
|
||||
* getting here: tcp_collapse might have deleted it
|
||||
|
@@ -2627,7 +2627,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
|
||||
}
|
||||
|
||||
return xfrm_migrate(&sel, dir, XFRM_POLICY_TYPE_MAIN, m, i,
|
||||
kma ? &k : NULL, net, NULL);
|
||||
kma ? &k : NULL, net, NULL, 0);
|
||||
|
||||
out:
|
||||
return err;
|
||||
|
@@ -9,7 +9,7 @@
|
||||
* Copyright 2007, Michael Wu <flamingice@sourmilk.net>
|
||||
* Copyright 2007-2010, Intel Corporation
|
||||
* Copyright(c) 2015-2017 Intel Deutschland GmbH
|
||||
* Copyright (C) 2018 - 2021 Intel Corporation
|
||||
* Copyright (C) 2018 - 2022 Intel Corporation
|
||||
*/
|
||||
|
||||
#include <linux/ieee80211.h>
|
||||
@@ -626,6 +626,14 @@ int ieee80211_start_tx_ba_session(struct ieee80211_sta *pubsta, u16 tid,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (test_sta_flag(sta, WLAN_STA_MFP) &&
|
||||
!test_sta_flag(sta, WLAN_STA_AUTHORIZED)) {
|
||||
ht_dbg(sdata,
|
||||
"MFP STA not authorized - deny BA session request %pM tid %d\n",
|
||||
sta->sta.addr, tid);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
/*
|
||||
* 802.11n-2009 11.5.1.1: If the initiating STA is an HT STA, is a
|
||||
* member of an IBSS, and has no other existing Block Ack agreement
|
||||
|
@@ -149,6 +149,12 @@ static enum sctp_disposition __sctp_sf_do_9_1_abort(
|
||||
void *arg,
|
||||
struct sctp_cmd_seq *commands);
|
||||
|
||||
static enum sctp_disposition
|
||||
__sctp_sf_do_9_2_reshutack(struct net *net, const struct sctp_endpoint *ep,
|
||||
const struct sctp_association *asoc,
|
||||
const union sctp_subtype type, void *arg,
|
||||
struct sctp_cmd_seq *commands);
|
||||
|
||||
/* Small helper function that checks if the chunk length
|
||||
* is of the appropriate length. The 'required_length' argument
|
||||
* is set to be the size of a specific chunk we are testing.
|
||||
@@ -330,6 +336,14 @@ enum sctp_disposition sctp_sf_do_5_1B_init(struct net *net,
|
||||
if (!chunk->singleton)
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* Make sure that the INIT chunk has a valid length.
|
||||
* Normally, this would cause an ABORT with a Protocol Violation
|
||||
* error, but since we don't have an association, we'll
|
||||
* just discard the packet.
|
||||
*/
|
||||
if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* If the packet is an OOTB packet which is temporarily on the
|
||||
* control endpoint, respond with an ABORT.
|
||||
*/
|
||||
@@ -344,14 +358,6 @@ enum sctp_disposition sctp_sf_do_5_1B_init(struct net *net,
|
||||
if (chunk->sctp_hdr->vtag != 0)
|
||||
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* Make sure that the INIT chunk has a valid length.
|
||||
* Normally, this would cause an ABORT with a Protocol Violation
|
||||
* error, but since we don't have an association, we'll
|
||||
* just discard the packet.
|
||||
*/
|
||||
if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* If the INIT is coming toward a closing socket, we'll send back
|
||||
* and ABORT. Essentially, this catches the race of INIT being
|
||||
* backloged to the socket at the same time as the user isses close().
|
||||
@@ -1484,19 +1490,16 @@ static enum sctp_disposition sctp_sf_do_unexpected_init(
|
||||
if (!chunk->singleton)
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* Make sure that the INIT chunk has a valid length. */
|
||||
if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* 3.1 A packet containing an INIT chunk MUST have a zero Verification
|
||||
* Tag.
|
||||
*/
|
||||
if (chunk->sctp_hdr->vtag != 0)
|
||||
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
|
||||
|
||||
/* Make sure that the INIT chunk has a valid length.
|
||||
* In this case, we generate a protocol violation since we have
|
||||
* an association established.
|
||||
*/
|
||||
if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
|
||||
return sctp_sf_violation_chunklen(net, ep, asoc, type, arg,
|
||||
commands);
|
||||
/* Grab the INIT header. */
|
||||
chunk->subh.init_hdr = (struct sctp_inithdr *)chunk->skb->data;
|
||||
|
||||
@@ -1814,9 +1817,9 @@ static enum sctp_disposition sctp_sf_do_dupcook_a(
|
||||
* its peer.
|
||||
*/
|
||||
if (sctp_state(asoc, SHUTDOWN_ACK_SENT)) {
|
||||
disposition = sctp_sf_do_9_2_reshutack(net, ep, asoc,
|
||||
SCTP_ST_CHUNK(chunk->chunk_hdr->type),
|
||||
chunk, commands);
|
||||
disposition = __sctp_sf_do_9_2_reshutack(net, ep, asoc,
|
||||
SCTP_ST_CHUNK(chunk->chunk_hdr->type),
|
||||
chunk, commands);
|
||||
if (SCTP_DISPOSITION_NOMEM == disposition)
|
||||
goto nomem;
|
||||
|
||||
@@ -2915,13 +2918,11 @@ enum sctp_disposition sctp_sf_do_9_2_shut_ctsn(
|
||||
* that belong to this association, it should discard the INIT chunk and
|
||||
* retransmit the SHUTDOWN ACK chunk.
|
||||
*/
|
||||
enum sctp_disposition sctp_sf_do_9_2_reshutack(
|
||||
struct net *net,
|
||||
const struct sctp_endpoint *ep,
|
||||
const struct sctp_association *asoc,
|
||||
const union sctp_subtype type,
|
||||
void *arg,
|
||||
struct sctp_cmd_seq *commands)
|
||||
static enum sctp_disposition
|
||||
__sctp_sf_do_9_2_reshutack(struct net *net, const struct sctp_endpoint *ep,
|
||||
const struct sctp_association *asoc,
|
||||
const union sctp_subtype type, void *arg,
|
||||
struct sctp_cmd_seq *commands)
|
||||
{
|
||||
struct sctp_chunk *chunk = arg;
|
||||
struct sctp_chunk *reply;
|
||||
@@ -2955,6 +2956,26 @@ nomem:
|
||||
return SCTP_DISPOSITION_NOMEM;
|
||||
}
|
||||
|
||||
enum sctp_disposition
|
||||
sctp_sf_do_9_2_reshutack(struct net *net, const struct sctp_endpoint *ep,
|
||||
const struct sctp_association *asoc,
|
||||
const union sctp_subtype type, void *arg,
|
||||
struct sctp_cmd_seq *commands)
|
||||
{
|
||||
struct sctp_chunk *chunk = arg;
|
||||
|
||||
if (!chunk->singleton)
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
if (!sctp_chunk_length_valid(chunk, sizeof(struct sctp_init_chunk)))
|
||||
return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
||||
|
||||
if (chunk->sctp_hdr->vtag != 0)
|
||||
return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands);
|
||||
|
||||
return __sctp_sf_do_9_2_reshutack(net, ep, asoc, type, arg, commands);
|
||||
}
|
||||
|
||||
/*
|
||||
* sctp_sf_do_ecn_cwr
|
||||
*
|
||||
|
@@ -17136,7 +17136,8 @@ void cfg80211_ch_switch_notify(struct net_device *dev,
|
||||
wdev->chandef = *chandef;
|
||||
wdev->preset_chandef = *chandef;
|
||||
|
||||
if (wdev->iftype == NL80211_IFTYPE_STATION &&
|
||||
if ((wdev->iftype == NL80211_IFTYPE_STATION ||
|
||||
wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
|
||||
!WARN_ON(!wdev->current_bss))
|
||||
cfg80211_update_assoc_bss_entry(wdev, chandef->chan);
|
||||
|
||||
|
@@ -4292,7 +4292,7 @@ static bool xfrm_migrate_selector_match(const struct xfrm_selector *sel_cmp,
|
||||
}
|
||||
|
||||
static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *sel,
|
||||
u8 dir, u8 type, struct net *net)
|
||||
u8 dir, u8 type, struct net *net, u32 if_id)
|
||||
{
|
||||
struct xfrm_policy *pol, *ret = NULL;
|
||||
struct hlist_head *chain;
|
||||
@@ -4301,7 +4301,8 @@ static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *
|
||||
spin_lock_bh(&net->xfrm.xfrm_policy_lock);
|
||||
chain = policy_hash_direct(net, &sel->daddr, &sel->saddr, sel->family, dir);
|
||||
hlist_for_each_entry(pol, chain, bydst) {
|
||||
if (xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||
if ((if_id == 0 || pol->if_id == if_id) &&
|
||||
xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||
pol->type == type) {
|
||||
ret = pol;
|
||||
priority = ret->priority;
|
||||
@@ -4313,7 +4314,8 @@ static struct xfrm_policy *xfrm_migrate_policy_find(const struct xfrm_selector *
|
||||
if ((pol->priority >= priority) && ret)
|
||||
break;
|
||||
|
||||
if (xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||
if ((if_id == 0 || pol->if_id == if_id) &&
|
||||
xfrm_migrate_selector_match(sel, &pol->selector) &&
|
||||
pol->type == type) {
|
||||
ret = pol;
|
||||
break;
|
||||
@@ -4429,7 +4431,7 @@ static int xfrm_migrate_check(const struct xfrm_migrate *m, int num_migrate)
|
||||
int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
||||
struct xfrm_migrate *m, int num_migrate,
|
||||
struct xfrm_kmaddress *k, struct net *net,
|
||||
struct xfrm_encap_tmpl *encap)
|
||||
struct xfrm_encap_tmpl *encap, u32 if_id)
|
||||
{
|
||||
int i, err, nx_cur = 0, nx_new = 0;
|
||||
struct xfrm_policy *pol = NULL;
|
||||
@@ -4448,14 +4450,14 @@ int xfrm_migrate(const struct xfrm_selector *sel, u8 dir, u8 type,
|
||||
}
|
||||
|
||||
/* Stage 1 - find policy */
|
||||
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net)) == NULL) {
|
||||
if ((pol = xfrm_migrate_policy_find(sel, dir, type, net, if_id)) == NULL) {
|
||||
err = -ENOENT;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Stage 2 - find and update state(s) */
|
||||
for (i = 0, mp = m; i < num_migrate; i++, mp++) {
|
||||
if ((x = xfrm_migrate_state_find(mp, net))) {
|
||||
if ((x = xfrm_migrate_state_find(mp, net, if_id))) {
|
||||
x_cur[nx_cur] = x;
|
||||
nx_cur++;
|
||||
xc = xfrm_state_migrate(x, mp, encap);
|
||||
|
@@ -1542,9 +1542,6 @@ static struct xfrm_state *xfrm_state_clone(struct xfrm_state *orig,
|
||||
memcpy(&x->mark, &orig->mark, sizeof(x->mark));
|
||||
memcpy(&x->props.smark, &orig->props.smark, sizeof(x->props.smark));
|
||||
|
||||
if (xfrm_init_state(x) < 0)
|
||||
goto error;
|
||||
|
||||
x->props.flags = orig->props.flags;
|
||||
x->props.extra_flags = orig->props.extra_flags;
|
||||
|
||||
@@ -1566,7 +1563,8 @@ out:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net)
|
||||
struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *net,
|
||||
u32 if_id)
|
||||
{
|
||||
unsigned int h;
|
||||
struct xfrm_state *x = NULL;
|
||||
@@ -1582,6 +1580,8 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
||||
continue;
|
||||
if (m->reqid && x->props.reqid != m->reqid)
|
||||
continue;
|
||||
if (if_id != 0 && x->if_id != if_id)
|
||||
continue;
|
||||
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
||||
m->old_family) ||
|
||||
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
||||
@@ -1597,6 +1597,8 @@ struct xfrm_state *xfrm_migrate_state_find(struct xfrm_migrate *m, struct net *n
|
||||
if (x->props.mode != m->mode ||
|
||||
x->id.proto != m->proto)
|
||||
continue;
|
||||
if (if_id != 0 && x->if_id != if_id)
|
||||
continue;
|
||||
if (!xfrm_addr_equal(&x->id.daddr, &m->old_daddr,
|
||||
m->old_family) ||
|
||||
!xfrm_addr_equal(&x->props.saddr, &m->old_saddr,
|
||||
@@ -1623,6 +1625,11 @@ struct xfrm_state *xfrm_state_migrate(struct xfrm_state *x,
|
||||
if (!xc)
|
||||
return NULL;
|
||||
|
||||
xc->props.family = m->new_family;
|
||||
|
||||
if (xfrm_init_state(xc) < 0)
|
||||
goto error;
|
||||
|
||||
memcpy(&xc->id.daddr, &m->new_daddr, sizeof(xc->id.daddr));
|
||||
memcpy(&xc->props.saddr, &m->new_saddr, sizeof(xc->props.saddr));
|
||||
|
||||
|
@@ -621,13 +621,8 @@ static struct xfrm_state *xfrm_state_construct(struct net *net,
|
||||
|
||||
xfrm_smark_init(attrs, &x->props.smark);
|
||||
|
||||
if (attrs[XFRMA_IF_ID]) {
|
||||
if (attrs[XFRMA_IF_ID])
|
||||
x->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||
if (!x->if_id) {
|
||||
err = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
err = __xfrm_init_state(x, false, attrs[XFRMA_OFFLOAD_DEV]);
|
||||
if (err)
|
||||
@@ -1358,13 +1353,8 @@ static int xfrm_alloc_userspi(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
|
||||
mark = xfrm_mark_get(attrs, &m);
|
||||
|
||||
if (attrs[XFRMA_IF_ID]) {
|
||||
if (attrs[XFRMA_IF_ID])
|
||||
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||
if (!if_id) {
|
||||
err = -EINVAL;
|
||||
goto out_noput;
|
||||
}
|
||||
}
|
||||
|
||||
if (p->info.seq) {
|
||||
x = xfrm_find_acq_byseq(net, mark, p->info.seq);
|
||||
@@ -1677,13 +1667,8 @@ static struct xfrm_policy *xfrm_policy_construct(struct net *net, struct xfrm_us
|
||||
|
||||
xfrm_mark_get(attrs, &xp->mark);
|
||||
|
||||
if (attrs[XFRMA_IF_ID]) {
|
||||
if (attrs[XFRMA_IF_ID])
|
||||
xp->if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||
if (!xp->if_id) {
|
||||
err = -EINVAL;
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
|
||||
return xp;
|
||||
error:
|
||||
@@ -2438,6 +2423,7 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
int n = 0;
|
||||
struct net *net = sock_net(skb->sk);
|
||||
struct xfrm_encap_tmpl *encap = NULL;
|
||||
u32 if_id = 0;
|
||||
|
||||
if (attrs[XFRMA_MIGRATE] == NULL)
|
||||
return -EINVAL;
|
||||
@@ -2462,7 +2448,10 @@ static int xfrm_do_migrate(struct sk_buff *skb, struct nlmsghdr *nlh,
|
||||
return 0;
|
||||
}
|
||||
|
||||
err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap);
|
||||
if (attrs[XFRMA_IF_ID])
|
||||
if_id = nla_get_u32(attrs[XFRMA_IF_ID]);
|
||||
|
||||
err = xfrm_migrate(&pi->sel, pi->dir, type, m, n, kmp, net, encap, if_id);
|
||||
|
||||
kfree(encap);
|
||||
|
||||
|
@@ -46,6 +46,7 @@
|
||||
#include <signal.h>
|
||||
#include <poll.h>
|
||||
#include <string.h>
|
||||
#include <linux/mman.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/ioctl.h>
|
||||
|
Reference in New Issue
Block a user