* [PATCH] fs/9p: Initialize status in v9fs_file_do_lock.
@ 2015-01-09 11:56 Dominique Martinet
2015-01-09 12:33 ` Kirill A. Shutemov
0 siblings, 1 reply; 5+ messages in thread
From: Dominique Martinet @ 2015-01-09 11:56 UTC (permalink / raw)
To: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov
Cc: v9fs-developer, linux-fsdevel, linux-kernel, Dominique Martinet
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).
Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
---
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 5594505..9b02849 100644
--- a/fs/9p/vfs_file.c
+++ b/fs/9p/vfs_file.c
@@ -149,7 +149,7 @@ static int v9fs_file_do_lock(struct file *filp, int cmd, struct file_lock *fl)
{
struct p9_flock flock;
struct p9_fid *fid;
- uint8_t status;
+ uint8_t status = P9_LOCK_ERROR;
int res = 0;
unsigned char fl_type;
--
1.9.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/9p: Initialize status in v9fs_file_do_lock.
2015-01-09 11:56 [PATCH] fs/9p: Initialize status in v9fs_file_do_lock Dominique Martinet
@ 2015-01-09 12:33 ` Kirill A. Shutemov
2015-01-09 13:07 ` Dominique Martinet
0 siblings, 1 reply; 5+ messages in thread
From: Kirill A. Shutemov @ 2015-01-09 12:33 UTC (permalink / raw)
To: Dominique Martinet
Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
v9fs-developer, linux-fsdevel, linux-kernel
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
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/9p: Initialize status in v9fs_file_do_lock.
2015-01-09 12:33 ` Kirill A. Shutemov
@ 2015-01-09 13:07 ` Dominique Martinet
2015-01-09 13:20 ` Kirill A. Shutemov
0 siblings, 1 reply; 5+ messages in thread
From: Dominique Martinet @ 2015-01-09 13:07 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
v9fs-developer, linux-fsdevel, linux-kernel
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/9p: Initialize status in v9fs_file_do_lock.
2015-01-09 13:07 ` Dominique Martinet
@ 2015-01-09 13:20 ` Kirill A. Shutemov
2015-01-09 13:29 ` Dominique Martinet
0 siblings, 1 reply; 5+ messages in thread
From: Kirill A. Shutemov @ 2015-01-09 13:20 UTC (permalink / raw)
To: Dominique Martinet
Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
v9fs-developer, linux-fsdevel, linux-kernel
On Fri, Jan 09, 2015 at 02:07:23PM +0100, Dominique Martinet wrote:
> 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.
No, if p9_client_lock_dotl() return 0 it must set status. If it's not,
that's bug on p9_client_lock_dotl() side and must be fixed.
--
Kirill A. Shutemov
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] fs/9p: Initialize status in v9fs_file_do_lock.
2015-01-09 13:20 ` Kirill A. Shutemov
@ 2015-01-09 13:29 ` Dominique Martinet
0 siblings, 0 replies; 5+ messages in thread
From: Dominique Martinet @ 2015-01-09 13:29 UTC (permalink / raw)
To: Kirill A. Shutemov
Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov,
v9fs-developer, linux-fsdevel, linux-kernel
Kirill A. Shutemov wrote on Fri, Jan 09, 2015 at 03:20:51PM +0200:
> > 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.
>
> No, if p9_client_lock_dotl() return 0 it must set status. If it's not,
> that's bug on p9_client_lock_dotl() side and must be fixed.
I had that bit right, but I only remembered your second patch -- sorry.
It should be fine with your patchES, please disregard this one.
--
Dominique Martinet,
CEA
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2015-01-09 13:29 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-09 11:56 [PATCH] fs/9p: Initialize status in v9fs_file_do_lock Dominique Martinet
2015-01-09 12:33 ` Kirill A. Shutemov
2015-01-09 13:07 ` Dominique Martinet
2015-01-09 13:20 ` Kirill A. Shutemov
2015-01-09 13:29 ` Dominique Martinet
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).