All of lore.kernel.org
 help / color / mirror / Atom feed
* re: cgroup: use a per-cgroup work for release agent
@ 2014-09-19 16:09 Dan Carpenter
  2014-09-20  2:32 ` Zefan Li
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-09-19 16:09 UTC (permalink / raw)
  To: lizefan-hv44wF8Li93QT0dZR+AlfA; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

Hello Zefan Li,

The patch 971ff4935538: "cgroup: use a per-cgroup work for release
agent" from Sep 18, 2014, leads to the following static checker
warning:

	kernel/cgroup.c:5310 cgroup_release_agent()
	warn: 'mutex:&cgroup_mutex' is sometimes locked here and sometimes unlocked.

kernel/cgroup.c
  5279  static void cgroup_release_agent(struct work_struct *work)
  5280  {
  5281          struct cgroup *cgrp =
  5282                  container_of(work, struct cgroup, release_agent_work);
  5283          char *pathbuf = NULL, *agentbuf = NULL, *path;
  5284          char *argv[3], *envp[3];
  5285  
  5286          mutex_lock(&cgroup_mutex);
  5287  
  5288          pathbuf = kmalloc(PATH_MAX, GFP_KERNEL);
  5289          agentbuf = kstrdup(cgrp->root->release_agent_path, GFP_KERNEL);
  5290          if (!pathbuf || !agentbuf)
  5291                  goto out;
  5292  
  5293          path = cgroup_path(cgrp, pathbuf, PATH_MAX);
  5294          if (!path)
  5295                  goto out;

Should unlock before the goto.

  5296  
  5297          argv[0] = agentbuf;
  5298          argv[1] = path;
  5299          argv[2] = NULL;
  5300  
  5301          /* minimal command environment */
  5302          envp[0] = "HOME=/";
  5303          envp[1] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
  5304          envp[2] = NULL;
  5305  
  5306          mutex_unlock(&cgroup_mutex);
  5307          call_usermodehelper(argv[0], argv, envp, UMH_WAIT_EXEC);
  5308  out:
  5309          kfree(agentbuf);
  5310          kfree(pathbuf);
  5311  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: cgroup: use a per-cgroup work for release agent
  2014-09-19 16:09 cgroup: use a per-cgroup work for release agent Dan Carpenter
@ 2014-09-20  2:32 ` Zefan Li
  0 siblings, 0 replies; 2+ messages in thread
From: Zefan Li @ 2014-09-20  2:32 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: cgroups-u79uwXL29TY76Z2rM5mHXA

On 2014/9/20 0:09, Dan Carpenter wrote:
> Hello Zefan Li,
> 
> The patch 971ff4935538: "cgroup: use a per-cgroup work for release
> agent" from Sep 18, 2014, leads to the following static checker
> warning:
> 
> 	kernel/cgroup.c:5310 cgroup_release_agent()
> 	warn: 'mutex:&cgroup_mutex' is sometimes locked here and sometimes unlocked.
> 

Thanks! Will send out the fix soon.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-20  2:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-19 16:09 cgroup: use a per-cgroup work for release agent Dan Carpenter
2014-09-20  2:32 ` Zefan Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.