From: Dan Carpenter <error27@gmail.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
Changli Gao <xiaosuo@gmail.com>,
Ben Greear <greearb@candelatech.com>,
Neil Horman <nhorman@tuxdriver.com>,
"open list:NETWORKING [GENERAL]" <netdev@vger.kernel.org>,
kernel-janitors@vger.kernel.org
Subject: [patch] packet: add an unlock on error in fanout_add()
Date: Fri, 8 Jul 2011 10:28:12 +0300 [thread overview]
Message-ID: <20110708072812.GX18655@shale.localdomain> (raw)
We need to release the "fanout_mutex" here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index aec50a1..3cbe950 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -589,8 +589,10 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
break;
}
}
- if (match && match->defrag != defrag)
- return -EINVAL;
+ if (match && match->defrag != defrag) {
+ err = -EINVAL;
+ goto out_unlock;
+ }
if (!match) {
match = kzalloc(sizeof(*match), GFP_KERNEL);
if (match) {
@@ -626,6 +628,8 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
}
}
}
+
+out_unlock:
mutex_unlock(&fanout_mutex);
return err;
}
next reply other threads:[~2011-07-08 7:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-08 7:28 Dan Carpenter [this message]
2011-07-08 8:01 ` [patch] packet: add an unlock on error in fanout_add() Eric Dumazet
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=20110708072812.GX18655@shale.localdomain \
--to=error27@gmail.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=greearb@candelatech.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nhorman@tuxdriver.com \
--cc=xiaosuo@gmail.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