public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kernel-janitors@vger.kernel.org
Subject: re: fou: implement FOU_CMD_GET
Date: Tue, 14 Apr 2015 15:59:17 +0000	[thread overview]
Message-ID: <20150414155917.GA4693@mwanda> (raw)

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

                 reply	other threads:[~2015-04-14 15:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150414155917.GA4693@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox