nlmsg_end(skb, nlh);
 
-       /* fib_nl_{new,del}rule handling looks for net from skb->sk */
-       skb->sk = dev_net(dev)->rtnl;
        if (add_it) {
-               err = fib_nl_newrule(skb, nlh, NULL);
+               err = fib_newrule(dev_net(dev), skb, nlh, NULL, true);
                if (err == -EEXIST)
                        err = 0;
        } else {
-               err = fib_nl_delrule(skb, nlh, NULL);
+               err = fib_delrule(dev_net(dev), skb, nlh, NULL, true);
                if (err == -ENOENT)
                        err = 0;
        }
 
                   struct netlink_ext_ack *extack);
 unsigned int fib_rules_seq_read(const struct net *net, int family);
 
-int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
-                  struct netlink_ext_ack *extack);
-int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
-                  struct netlink_ext_ack *extack);
+int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
+               struct netlink_ext_ack *extack, bool rtnl_held);
+int fib_delrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
+               struct netlink_ext_ack *extack, bool rtnl_held);
 
 INDIRECT_CALLABLE_DECLARE(int fib6_rule_match(struct fib_rule *rule,
                                            struct flowi *fl, int flags));
 
        [FRA_FLOWLABEL_MASK] = { .type = NLA_BE32 },
 };
 
-int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
-                  struct netlink_ext_ack *extack)
+int fib_newrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
+               struct netlink_ext_ack *extack, bool rtnl_held)
 {
-       struct net *net = sock_net(skb->sk);
+       struct fib_rule *rule = NULL, *r, *last = NULL;
        struct fib_rule_hdr *frh = nlmsg_data(nlh);
+       int err = -EINVAL, unresolved = 0;
        struct fib_rules_ops *ops = NULL;
-       struct fib_rule *rule = NULL, *r, *last = NULL;
        struct nlattr *tb[FRA_MAX + 1];
-       int err = -EINVAL, unresolved = 0;
        bool user_priority = false;
 
        if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh))) {
        rules_ops_put(ops);
        return err;
 }
-EXPORT_SYMBOL_GPL(fib_nl_newrule);
+EXPORT_SYMBOL_GPL(fib_newrule);
 
-int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
-                  struct netlink_ext_ack *extack)
+static int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
+                         struct netlink_ext_ack *extack)
 {
-       struct net *net = sock_net(skb->sk);
+       return fib_newrule(sock_net(skb->sk), skb, nlh, extack, true);
+}
+
+int fib_delrule(struct net *net, struct sk_buff *skb, struct nlmsghdr *nlh,
+               struct netlink_ext_ack *extack, bool rtnl_held)
+{
+       struct fib_rule *rule = NULL, *nlrule = NULL;
        struct fib_rule_hdr *frh = nlmsg_data(nlh);
        struct fib_rules_ops *ops = NULL;
-       struct fib_rule *rule = NULL, *r, *nlrule = NULL;
        struct nlattr *tb[FRA_MAX+1];
-       int err = -EINVAL;
        bool user_priority = false;
+       int err = -EINVAL;
 
        if (nlh->nlmsg_len < nlmsg_msg_size(sizeof(*frh))) {
                NL_SET_ERR_MSG(extack, "Invalid msg length");
         * current if it is goto rule, have actually been added.
         */
        if (ops->nr_goto_rules > 0) {
-               struct fib_rule *n;
+               struct fib_rule *n, *r;
 
                n = list_next_entry(rule, list);
                if (&n->list == &ops->rules_list || n->pref != rule->pref)
        rules_ops_put(ops);
        return err;
 }
-EXPORT_SYMBOL_GPL(fib_nl_delrule);
+EXPORT_SYMBOL_GPL(fib_delrule);
+
+static int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
+                         struct netlink_ext_ack *extack)
+{
+       return fib_delrule(sock_net(skb->sk), skb, nlh, extack, true);
+}
 
 static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
                                         struct fib_rule *rule)