Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760411AbYGUH7i (ORCPT ); Mon, 21 Jul 2008 03:59:38 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1757282AbYGUH7T (ORCPT ); Mon, 21 Jul 2008 03:59:19 -0400 Received: from mgw2.diku.dk ([130.225.96.92]:35444 "EHLO mgw2.diku.dk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758323AbYGUH7R (ORCPT ); Mon, 21 Jul 2008 03:59:17 -0400 Date: Mon, 21 Jul 2008 09:59:15 +0200 (CEST) From: Julia Lawall To: mfasheh@suse.com, joel.becker@oracle.com, ocfs2-devel@oss.oracle.com, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH 7/7] fs/ocfs2/file.c: Release mutex in error handling code Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1027 Lines: 48 From: Julia Lawall The mutex is released on a successful return, so it would seem that it should be released on an error return as well. The semantic patch finds this problem is as follows: (http://www.emn.fr/x-info/coccinelle/) // @@ expression l; @@ mutex_lock(l); ... when != mutex_unlock(l) when any when strict ( if (...) { ... when != mutex_unlock(l) + mutex_unlock(l); return ...; } | mutex_unlock(l); ) // Signed-off-by: Julia Lawall --- diff -u -p a/fs/ocfs2/file.c b/fs/ocfs2/file.c --- a/fs/ocfs2/file.c +++ b/fs/ocfs2/file.c @@ -1766,8 +1766,8 @@ out_inode_unlock: out_rw_unlock: ocfs2_rw_unlock(inode, 1); - mutex_unlock(&inode->i_mutex); out: + mutex_unlock(&inode->i_mutex); return ret; } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/