Dan Carpenter
2016-Nov-17 10:03 UTC
[Ocfs2-devel] ocfs2: fix sparse file & data ordering issue in direct io
On Thu, Nov 17, 2016 at 11:08:08AM +0800, Eric Ren wrote:> Hi, > > On 11/16/2016 06:45 PM, Dan Carpenter wrote: > >On Wed, Nov 16, 2016 at 10:33:49AM +0800, Eric Ren wrote: > >That silences the warning, of course, but I feel like the code is buggy. > >How do we know that we don't hit that exit path? > Sorry, I missed your point. Do you mean the below? > > "1817 goto out_quota; " will free (*wc), but with "ret = 0". Thus, the caller > think it's OK to use (*wc), but... > > Do I understand you correctly? >It doesn't free it. It frees "wc" but not "*fsdata". So it leaves it unintialized on that path. That's the issue, yes. It could be that it's impossible to reach that path from here, but it's not clear to me. regards, dan carpenter
Junxiao Bi
2016-Nov-22 02:29 UTC
[Ocfs2-devel] ocfs2: fix sparse file & data ordering issue in direct io
Hi Dan, It will not cause a real issue. -EAGAIN can be only returned in __ocfs2_page_mkwrite() path where "locked_page" is NULL, so that function will return VM_FAULT_NOPAGE before accessing "fsdata". Thanks, Junxiao. On 11/17/2016 06:03 PM, Dan Carpenter wrote:> On Thu, Nov 17, 2016 at 11:08:08AM +0800, Eric Ren wrote: >> Hi, >> >> On 11/16/2016 06:45 PM, Dan Carpenter wrote: >>> On Wed, Nov 16, 2016 at 10:33:49AM +0800, Eric Ren wrote: >>> That silences the warning, of course, but I feel like the code is buggy. >>> How do we know that we don't hit that exit path? >> Sorry, I missed your point. Do you mean the below? >> >> "1817 goto out_quota; " will free (*wc), but with "ret = 0". Thus, the caller >> think it's OK to use (*wc), but... >> >> Do I understand you correctly? >> > > It doesn't free it. It frees "wc" but not "*fsdata". So it leaves it > unintialized on that path. That's the issue, yes. > > It could be that it's impossible to reach that path from here, but it's > not clear to me. > > regards, > dan carpenter > > > _______________________________________________ > Ocfs2-devel mailing list > Ocfs2-devel at oss.oracle.com > https://oss.oracle.com/mailman/listinfo/ocfs2-devel >