On Wed, 2017-12-13 at 13:43 -0800, Dmitry Torokhov wrote: > Hi Eric, > > On Thu, Oct 19, 2017 at 7:11 AM, Eric Dumazet <eduma...@google.com> wrote: > > > > On Thu, Oct 19, 2017 at 4:48 AM, Tariq Toukan <tar...@mellanox.com> wrote: > > > > > > Hi Eric, > > > > > > I just wanted to check if this is solved already, as I don't want to keep > > > an > > > unnecessary revert patch in our internal branches. > > > According to my check bug still exists. > > > > > > > I will handle this today, thanks for the reminder. > > Did you have a chance to do this? It looks like the original change > landed on mainline and causes modules to be autoloaded on KOBJ_UNBIND > again. > > Thanks!
I sent the following to Tariq, and he tested it successfully. I will submit this formally. diff --git a/lib/kobject_uevent.c b/lib/kobject_uevent.c index c3e84edc47c965d40199b652ba78876cdaa9c70c..0795482b15d5a8f1b65b570a071aa1419cb923d8 100644 --- a/lib/kobject_uevent.c +++ b/lib/kobject_uevent.c @@ -346,19 +346,25 @@ static int kobject_uevent_net_broadcast(struct kobject *kobj, static void zap_modalias_env(struct kobj_uevent_env *env) { static const char modalias_prefix[] = "MODALIAS="; + size_t offset = 0, len; int i; for (i = 0; i < env->envp_idx;) { + len = strlen(env->envp[i]) + 1; if (strncmp(env->envp[i], modalias_prefix, sizeof(modalias_prefix) - 1)) { i++; + offset += len; continue; } - if (i != env->envp_idx - 1) + env->buflen -= len; + if (i != env->envp_idx - 1) { + memmove(env->envp[i], env->envp[i + 1], + env->buflen - offset); memmove(&env->envp[i], &env->envp[i + 1], sizeof(env->envp[i]) * env->envp_idx - 1); - + } env->envp_idx--; } }