From patchwork Sun Jun 22 23:44:21 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sasha Levin X-Patchwork-Id: 4396881 Return-Path: X-Original-To: patchwork-v9fs-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 85B08BEEAA for ; Sun, 22 Jun 2014 23:45:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C39722021A for ; Sun, 22 Jun 2014 23:45:13 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D7080201F7 for ; Sun, 22 Jun 2014 23:45:12 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=sfs-ml-2.v29.ch3.sourceforge.com) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1WyrRT-0001Z3-Ac; Sun, 22 Jun 2014 23:44:59 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-2.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1WyrRS-0001Yx-B4 for v9fs-developer@lists.sourceforge.net; Sun, 22 Jun 2014 23:44:58 +0000 Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of oracle.com designates 141.146.126.69 as permitted sender) client-ip=141.146.126.69; envelope-from=sasha.levin@oracle.com; helo=aserp1040.oracle.com; Received: from aserp1040.oracle.com ([141.146.126.69]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) id 1WyrRQ-0006fX-ID for v9fs-developer@lists.sourceforge.net; Sun, 22 Jun 2014 23:44:58 +0000 Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s5MNiW4D027673 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 22 Jun 2014 23:44:33 GMT Received: from userz7022.oracle.com (userz7022.oracle.com [156.151.31.86]) by ucsinet22.oracle.com (8.14.5+Sun/8.14.5) with ESMTP id s5MNiSBd006154 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 22 Jun 2014 23:44:29 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userz7022.oracle.com (8.14.5+Sun/8.14.4) with ESMTP id s5MNiRl8006128; Sun, 22 Jun 2014 23:44:28 GMT Received: from lappy.hsd1.nh.comcast.net (/10.154.146.93) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 22 Jun 2014 16:44:27 -0700 From: Sasha Levin To: ericvh@gmail.com, rminnich@sandia.gov, lucho@ionkov.net Date: Sun, 22 Jun 2014 19:44:21 -0400 Message-Id: <1403480661-32620-1-git-send-email-sasha.levin@oracle.com> X-Mailer: git-send-email 1.9.1 X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-Spam-Score: -1.5 (-) X-Headers-End: 1WyrRQ-0006fX-ID Cc: v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, Sasha Levin Subject: [V9fs-developer] [PATCH] fs/9p/: don't treat error as status value in file locking X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When trying to lock a file we didn't properly handle the case where a failure in p9_client_lock_dotl() occurs and treated the status value as valid instead of discarding it due to the error. This would usually trigger a BUG() since the status value would just be stack garbage. Signed-off-by: Sasha Levin --- fs/9p/vfs_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index 520c11c..06077f3 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c @@ -194,7 +194,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl) for (;;) { res = p9_client_lock_dotl(fid, &flock, &status); if (res < 0) - break; + return res; if (status != P9_LOCK_BLOCKED) break;