From patchwork Fri Jul 8 07:28:12 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 103775 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id ACA1DB6F77 for ; Fri, 8 Jul 2011 17:29:34 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752326Ab1GHH33 (ORCPT ); Fri, 8 Jul 2011 03:29:29 -0400 Received: from mail-pv0-f174.google.com ([74.125.83.174]:40272 "EHLO mail-pv0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751106Ab1GHH32 (ORCPT ); Fri, 8 Jul 2011 03:29:28 -0400 Received: by pvg12 with SMTP id 12so965519pvg.19 for ; Fri, 08 Jul 2011 00:29:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; bh=xcPFM8sdsewQW7KW26EwvlYoM66EPQCZkoxZ1RzJ0do=; b=RZ4MgjoVhDEdo3YVkLLFy08AdnoFOQstFBoHYZhl/Yt0JCuCkKD18qRS+/BN44wxSh pNarZFNWGYudAuJkMFfUiuE3p3x5Rlm04orfsIFprIF1GOchBDwdjhqNDKJg2kwL0A0s IsneoCXykzGkK6oDvu0KEI8Ul+1/gpYqO8zPw= Received: by 10.68.8.66 with SMTP id p2mr2393949pba.505.1310110168079; Fri, 08 Jul 2011 00:29:28 -0700 (PDT) Received: from shale.localdomain ([41.139.221.94]) by mx.google.com with ESMTPS id d1sm6113272pbj.40.2011.07.08.00.29.22 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 08 Jul 2011 00:29:27 -0700 (PDT) Date: Fri, 8 Jul 2011 10:28:12 +0300 From: Dan Carpenter To: "David S. Miller" Cc: Eric Dumazet , Changli Gao , Ben Greear , Neil Horman , "open list:NETWORKING [GENERAL]" , kernel-janitors@vger.kernel.org Subject: [patch] packet: add an unlock on error in fanout_add() Message-ID: <20110708072812.GX18655@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org We need to release the "fanout_mutex" here. Signed-off-by: Dan Carpenter --- 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 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; }