public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* re: fou: implement FOU_CMD_GET
@ 2015-04-14 15:59 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-04-14 15:59 UTC (permalink / raw)
  To: kernel-janitors

Hello WANG Cong,

The patch 7a6c8c34e5b7: "fou: implement FOU_CMD_GET" from Apr 10,
2015, leads to the following static checker warning:

	net/ipv4/fou.c:720 fou_nl_dump()
	warn: 'mutex:&fn->fou_lock' is sometimes locked here and sometimes unlocked.

net/ipv4/fou.c
   699  static int fou_nl_dump(struct sk_buff *skb, struct netlink_callback *cb)
   700  {
   701          struct net *net = sock_net(skb->sk);
   702          struct fou_net *fn = net_generic(net, fou_net_id);
   703          struct fou *fout;
   704          int idx = 0, ret;
   705  
   706          mutex_lock(&fn->fou_lock);
   707          list_for_each_entry(fout, &fn->fou_list, list) {
   708                  if (idx++ < cb->args[0])
   709                          continue;
   710                  ret = fou_dump_info(fout, NETLINK_CB(cb->skb).portid,
   711                                      cb->nlh->nlmsg_seq, NLM_F_MULTI,
   712                                      skb, FOU_CMD_GET);
   713                  if (ret)
   714                          goto done;
   715          }
   716          mutex_unlock(&fn->fou_lock);
   717  
   718  done:

Probably the unlock should happen after the label.

   719          cb->args[0] = idx;
   720          return skb->len;
   721  }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-04-14 15:59 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-14 15:59 fou: implement FOU_CMD_GET Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox