[patch] packet: add an unlock on error in fanout_add()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We need to release the "fanout_mutex" here.

Signed-off-by: Dan Carpenter <error27@xxxxxxxxx>

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;
 }
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux