aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@coreworks.de>2005-01-12 16:51:01 +0100
committerPatrick McHardy <kaber@coreworks.de>2005-01-12 16:51:01 +0100
commit437293de63d8979bd9288a29352899e72fff581a (patch)
treef9466925bf0df16bdc3325ce006f4e7755c705df /net
parentb406b3fbdda2c643f8a776f3e44576e40a7cd8bd (diff)
downloadhistory-437293de63d8979bd9288a29352899e72fff581a.tar.gz
[PKT_SCHED]: cls_api.c: drop rtnl for loading modules
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'net')
-rw-r--r--net/sched/cls_api.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c
index 1485789e70e7b2..47cdb71d6b3a00 100644
--- a/net/sched/cls_api.c
+++ b/net/sched/cls_api.c
@@ -142,7 +142,7 @@ static int tc_ctl_tfilter(struct sk_buff *skb, struct nlmsghdr *n, void *arg)
struct tcf_proto *tp;
struct tcf_proto_ops *tp_ops;
struct Qdisc_class_ops *cops;
- unsigned long cl = 0;
+ unsigned long cl;
unsigned long fh;
int err;
@@ -153,6 +153,7 @@ replay:
prio = TC_H_MAJ(t->tcm_info);
nprio = prio;
parent = t->tcm_parent;
+ cl = 0;
if (prio == 0) {
/* If no priority is given, user wants we allocated it. */
@@ -219,20 +220,29 @@ replay:
err = -ENOBUFS;
if ((tp = kmalloc(sizeof(*tp), GFP_KERNEL)) == NULL)
goto errout;
+ err = -EINVAL;
tp_ops = tcf_proto_lookup_ops(tca[TCA_KIND-1]);
+ if (tp_ops == NULL) {
#ifdef CONFIG_KMOD
- if (tp_ops==NULL && tca[TCA_KIND-1] != NULL) {
struct rtattr *kind = tca[TCA_KIND-1];
char name[IFNAMSIZ];
- if (rtattr_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
+ if (kind != NULL &&
+ rtattr_strlcpy(name, kind, IFNAMSIZ) < IFNAMSIZ) {
+ rtnl_unlock();
request_module("cls_%s", name);
+ rtnl_lock();
tp_ops = tcf_proto_lookup_ops(kind);
+ /* We dropped the RTNL semaphore in order to
+ * perform the module load. So, even if we
+ * succeeded in loading the module we have to
+ * replay the request. We indicate this using
+ * -EAGAIN.
+ */
+ if (tp_ops != NULL)
+ err = -EAGAIN;
}
- }
#endif
- if (tp_ops == NULL) {
- err = -EINVAL;
kfree(tp);
goto errout;
}