From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dominique Martinet Subject: Re: [PATCH] fs/9p: Initialize status in v9fs_file_do_lock. Date: Fri, 9 Jan 2015 14:07:23 +0100 Message-ID: <20150109130723.GA3183@u-isr-ctg-01> References: <1420804567-15371-1-git-send-email-dominique.martinet@cea.fr> <20150109123353.GA24928@node.dhcp.inet.fi> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Cc: Eric Van Hensbergen , Ron Minnich , Latchesar Ionkov , , , To: "Kirill A. Shutemov" Return-path: Received: from sainfoin-out.extra.cea.fr ([132.167.192.145]:56161 "EHLO sainfoin-out.extra.cea.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757115AbbAINHl (ORCPT ); Fri, 9 Jan 2015 08:07:41 -0500 Received: from pisaure.intra.cea.fr (pisaure.intra.cea.fr [132.166.88.21]) by sainfoin.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-2.3) with ESMTP id t09D7dfm020719 for ; Fri, 9 Jan 2015 14:07:39 +0100 Received: from pisaure.intra.cea.fr (localhost [127.0.0.1]) by localhost (Postfix) with SMTP id 2945420A7F0 for ; Fri, 9 Jan 2015 14:07:43 +0100 (CET) Received: from muguet1.intra.cea.fr (muguet1.intra.cea.fr [132.166.192.6]) by pisaure.intra.cea.fr (Postfix) with ESMTP id 15C6020A8A5 for ; Fri, 9 Jan 2015 14:07:43 +0100 (CET) Received: from zia.cdc.esteban.ctsi (out.dam.intra.cea.fr [132.165.76.10]) by muguet1.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.2) with SMTP id t09D7dJo026692 for ; Fri, 9 Jan 2015 14:07:39 +0100 Content-Disposition: inline In-Reply-To: <20150109123353.GA24928@node.dhcp.inet.fi> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Kirill A. Shutemov wrote on Fri, Jan 09, 2015 at 02:33:53PM +0200: > On Fri, Jan 09, 2015 at 12:56:07PM +0100, Dominique Martinet wrote: > > If p9_client_lock_dotl returns an error, status is possibly never filled > > but will be used in the following switch. > > Initializing it to P9_LOCK_ERROR makes sur we will return an error and > > cleanup (and not hit the default case). > > That's what my patch[1] fixes. > > http://marc.info/?i=1419858019-116944-1-git-send-email-kirill.shutemov%40linux.intel.com Actually, it's slightly different and still worth adding (mine if we apply your's first and your's if we apply mine first - don't think they'll conflict. I even reworded the (too old!) commit message to fit with your patch :)) Your patch will not BUG() if status is junk, BUT if status uninitialized value is 0 and p9_client_lock_dotl then we'll return res=0 (success) and not unlock before returning. My patch makes sure we'll return -ENOLCK. Likewise, if we only apply my patch then a rogue server could BUG() a client, so we want your's anyway. -- Dominique Martinet, CEA