From: "David S. Miller" <davem@davemloft.net>
To: tedu@coverity.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: missing spin_unlock in tcp_v4_get_port
Date: Mon, 22 Aug 2005 14:25:26 -0700 (PDT) [thread overview]
Message-ID: <20050822.142526.60284583.davem@davemloft.net> (raw)
In-Reply-To: <430A40F0.6030601@coverity.com>
From: Ted Unangst <tedu@coverity.com>
Subject: missing spin_unlock in tcp_v4_get_port
Date: Mon, 22 Aug 2005 14:17:36 -0700
> There appears to be a missing spin_unlock in tcp_v4_get_port.
>
> do { rover++;
> if (rover > high)
> rover = low;
> head = &tcp_bhash[tcp_bhashfn(rover)];
> spin_lock(&head->lock);
> head->lock is acquired.
> tb_for_each(tb, node, &head->chain)
> if (tb->port == rover)
> goto next;
> we don't find what we want. break out of while loop.
> break;
> next:
> spin_unlock(&head->lock);
> } while (--remaining > 0);
> tcp_port_rover = rover;
> spin_unlock(&tcp_portalloc_lock);
>
> /* Exhausted local port range during search? */
> ret = 1;
> if (remaining <= 0)
> goto fail;
> here we go to fail; head->lock is still acquired.
Only if remaining <= 0, in which case we broke out of the loop due to
the "while (--remaining > 0)" test, not because of the "break;"
statement, and thus the lock is not held.
prev parent reply other threads:[~2005-08-22 21:25 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-22 21:17 Ted Unangst
2005-08-22 21:25 ` David S. Miller [this message]
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=20050822.142526.60284583.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=tedu@coverity.com \
/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
all inboxes | Powered by JetHome®