Patchwork packet: add an unlock on error in fanout_add()

login
register
mail settings
Submitter Dan Carpenter
Date July 8, 2011, 7:28 a.m.
Message ID <20110708072812.GX18655@shale.localdomain>
Download mbox | patch
Permalink /patch/103775/
State Not Applicable
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - July 8, 2011, 7:28 a.m.
We need to release the "fanout_mutex" here.

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Eric Dumazet - July 8, 2011, 8:01 a.m.
Le vendredi 08 juillet 2011 à 10:28 +0300, Dan Carpenter a écrit :
> We need to release the "fanout_mutex" here.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 

Thanks, was fixed yesterday :

http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commit;h=afe62c68cd3562c5f8e3ea293e82906dd5a87936



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

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;
 }