From patchwork Wed Nov 4 10:04:26 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amerigo Wang X-Patchwork-Id: 37548 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.176.167]) by ozlabs.org (Postfix) with ESMTP id BCF9DB7BC7 for ; Wed, 4 Nov 2009 21:05:12 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755055AbZKDKEZ (ORCPT ); Wed, 4 Nov 2009 05:04:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755031AbZKDKEZ (ORCPT ); Wed, 4 Nov 2009 05:04:25 -0500 Received: from mx1.redhat.com ([209.132.183.28]:39694 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751045AbZKDKEY (ORCPT ); Wed, 4 Nov 2009 05:04:24 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nA4A4Tcu005214; Wed, 4 Nov 2009 05:04:29 -0500 Received: from localhost.localdomain (dhcp-65-141.nay.redhat.com [10.66.65.141]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nA4A4Qow020822; Wed, 4 Nov 2009 05:04:27 -0500 Date: Wed, 4 Nov 2009 05:04:26 -0500 From: Amerigo Wang To: linux-kernel@vger.kernel.org Cc: netdev@vger.kernel.org, Amerigo Wang , "David S. Miller" Message-Id: <20091104100717.4785.57149.sendpatchset@localhost.localdomain> Subject: [Patch] net: fix incorrect counting in __scm_destroy() X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org It seems that in __scm_destroy() we forgot to decrease the ->count after fput(->fp[i]), this may cause some problem when we recursively call fput() again. Signed-off-by: WANG Cong Cc: David S. Miller --- -- 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/core/scm.c b/net/core/scm.c index b7ba91b..fa53219 100644 --- a/net/core/scm.c +++ b/net/core/scm.c @@ -120,8 +120,10 @@ void __scm_destroy(struct scm_cookie *scm) fpl = list_first_entry(&work_list, struct scm_fp_list, list); list_del(&fpl->list); - for (i=fpl->count-1; i>=0; i--) + for (i = fpl->count-1; i >= 0; i--) { fput(fpl->fp[i]); + fpl->count--; + } kfree(fpl); }