if (!p || p->state == BR_STATE_DISABLED)
                goto drop;
 
+       br = p->br;
        brmctx = &p->br->multicast_ctx;
        pmctx = &p->multicast_ctx;
        state = p->state;
                                &state, &vlan))
                goto out;
 
+       if (p->flags & BR_PORT_LOCKED) {
+               struct net_bridge_fdb_entry *fdb_src =
+                       br_fdb_find_rcu(br, eth_hdr(skb)->h_source, vid);
+
+               if (!fdb_src || READ_ONCE(fdb_src->dst) != p ||
+                   test_bit(BR_FDB_LOCAL, &fdb_src->flags))
+                       goto drop;
+       }
+
        nbp_switchdev_frame_mark(p, skb);
 
        /* insert into forwarding database after filtering to avoid spoofing */
-       br = p->br;
        if (p->flags & BR_LEARNING)
                br_fdb_update(br, p, eth_hdr(skb)->h_source, vid, 0);
 
 
                + nla_total_size(1)     /* IFLA_BRPORT_VLAN_TUNNEL */
                + nla_total_size(1)     /* IFLA_BRPORT_NEIGH_SUPPRESS */
                + nla_total_size(1)     /* IFLA_BRPORT_ISOLATED */
+               + nla_total_size(1)     /* IFLA_BRPORT_LOCKED */
                + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_ROOT_ID */
                + nla_total_size(sizeof(struct ifla_bridge_id)) /* IFLA_BRPORT_BRIDGE_ID */
                + nla_total_size(sizeof(u16))   /* IFLA_BRPORT_DESIGNATED_PORT */
                                                          BR_MRP_LOST_CONT)) ||
            nla_put_u8(skb, IFLA_BRPORT_MRP_IN_OPEN,
                       !!(p->flags & BR_MRP_LOST_IN_CONT)) ||
-           nla_put_u8(skb, IFLA_BRPORT_ISOLATED, !!(p->flags & BR_ISOLATED)))
+           nla_put_u8(skb, IFLA_BRPORT_ISOLATED, !!(p->flags & BR_ISOLATED)) ||
+           nla_put_u8(skb, IFLA_BRPORT_LOCKED, !!(p->flags & BR_PORT_LOCKED)))
                return -EMSGSIZE;
 
        timerval = br_timer_value(&p->message_age_timer);
        [IFLA_BRPORT_GROUP_FWD_MASK] = { .type = NLA_U16 },
        [IFLA_BRPORT_NEIGH_SUPPRESS] = { .type = NLA_U8 },
        [IFLA_BRPORT_ISOLATED]  = { .type = NLA_U8 },
+       [IFLA_BRPORT_LOCKED] = { .type = NLA_U8 },
        [IFLA_BRPORT_BACKUP_PORT] = { .type = NLA_U32 },
        [IFLA_BRPORT_MCAST_EHT_HOSTS_LIMIT] = { .type = NLA_U32 },
 };
        br_set_port_flag(p, tb, IFLA_BRPORT_VLAN_TUNNEL, BR_VLAN_TUNNEL);
        br_set_port_flag(p, tb, IFLA_BRPORT_NEIGH_SUPPRESS, BR_NEIGH_SUPPRESS);
        br_set_port_flag(p, tb, IFLA_BRPORT_ISOLATED, BR_ISOLATED);
+       br_set_port_flag(p, tb, IFLA_BRPORT_LOCKED, BR_PORT_LOCKED);
 
        changed_mask = old_flags ^ p->flags;