@@ -306,11 +306,15 @@ struct kparam_array
#ifdef CONFIG_SYSFS
extern void kernel_param_lock(struct module *mod);
+extern int kernel_param_trylock(struct module *mod);
extern void kernel_param_unlock(struct module *mod);
#else
static inline void kernel_param_lock(struct module *mod)
{
}
+static inline int kernel_param_trylock(struct module *mod)
+{
+}
static inline void kernel_param_unlock(struct module *mod)
{
}
@@ -583,7 +583,9 @@ static ssize_t param_attr_store(const struct module_attribute *mattr,
if (!attribute->param->ops->set)
return -EPERM;
- kernel_param_lock(mk->mod);
+ if (!kernel_param_trylock(mk->mod))
+ return -EAGAIN;
+
if (param_check_unsafe(attribute->param))
err = attribute->param->ops->set(buf, attribute->param);
else
@@ -607,6 +609,11 @@ void kernel_param_lock(struct module *mod)
mutex_lock(KPARAM_MUTEX(mod));
}
+int kernel_param_trylock(struct module *mod)
+{
+ return mutex_trylock(KPARAM_MUTEX(mod));
+}
+
void kernel_param_unlock(struct module *mod)
{
mutex_unlock(KPARAM_MUTEX(mod));
@@ -217,7 +217,9 @@ ieee80211_rate_control_ops_get(const char *name)
const struct rate_control_ops *ops;
const char *alg_name;
- kernel_param_lock(THIS_MODULE);
+ if (!kernel_param_trylock(THIS_MODULE))
+ return NULL;
+
if (!name)
alg_name = ieee80211_default_rc_algo;
else