public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* Re: xfs: use after free on error in xfs_qm_log_quotaoff()
       [not found] <20140219095305.GA22351@elgon.mountain>
@ 2014-10-15 13:05 ` Dan Carpenter
  2014-10-16 13:28   ` Brian Foster
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2014-10-15 13:05 UTC (permalink / raw)
  To: xfs

This bug is still around.

regards,
dan carpenter

On Wed, Feb 19, 2014 at 12:53:05PM +0300, Dan Carpenter wrote:
> Smatch complains here.  I don't think I have reported this one before.
> It feels very familiar but I have grepped my outbox.
> 
> 	fs/xfs/xfs_qm_syscalls.c:814 xfs_qm_log_quotaoff()
> 	warn: 'tp' was already freed.
> 
> fs/xfs/xfs_qm_syscalls.c
>    804          /*
>    805           * We have to make sure that the transaction is secure on disk before we
>    806           * return and actually stop quota accounting. So, make it synchronous.
>    807           * We don't care about quotoff's performance.
>    808           */
>    809          xfs_trans_set_sync(tp);
>    810          error = xfs_trans_commit(tp, 0);
>                         ^^^^^^^^^^^^^^^^
> This function frees tp.
> 
>    811  
>    812  error0:
>    813          if (error) {
>    814                  xfs_trans_cancel(tp, 0);
>                         ^^^^^^^^^^^^^^^^^
> Use after free.
> 
>    815                  /*
>    816                   * No one else is modifying sb_qflags, so this is OK.
>    817                   * We still hold the quotaofflock.
>    818                   */
> 
> regards,
> dan carpenter

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: xfs: use after free on error in xfs_qm_log_quotaoff()
  2014-10-15 13:05 ` xfs: use after free on error in xfs_qm_log_quotaoff() Dan Carpenter
@ 2014-10-16 13:28   ` Brian Foster
  0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2014-10-16 13:28 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: xfs

On Wed, Oct 15, 2014 at 04:05:35PM +0300, Dan Carpenter wrote:
> This bug is still around.
> 
> regards,
> dan carpenter
> 
> On Wed, Feb 19, 2014 at 12:53:05PM +0300, Dan Carpenter wrote:
> > Smatch complains here.  I don't think I have reported this one before.
> > It feels very familiar but I have grepped my outbox.
> > 
> > 	fs/xfs/xfs_qm_syscalls.c:814 xfs_qm_log_quotaoff()
> > 	warn: 'tp' was already freed.
> > 

Heh, looks like this function also has a problem restoring flags. If the
reserve fails we restore flags to 0 rather than the old flags. I'll send
a patch shortly.

Brian

> > fs/xfs/xfs_qm_syscalls.c
> >    804          /*
> >    805           * We have to make sure that the transaction is secure on disk before we
> >    806           * return and actually stop quota accounting. So, make it synchronous.
> >    807           * We don't care about quotoff's performance.
> >    808           */
> >    809          xfs_trans_set_sync(tp);
> >    810          error = xfs_trans_commit(tp, 0);
> >                         ^^^^^^^^^^^^^^^^
> > This function frees tp.
> > 
> >    811  
> >    812  error0:
> >    813          if (error) {
> >    814                  xfs_trans_cancel(tp, 0);
> >                         ^^^^^^^^^^^^^^^^^
> > Use after free.
> > 
> >    815                  /*
> >    816                   * No one else is modifying sb_qflags, so this is OK.
> >    817                   * We still hold the quotaofflock.
> >    818                   */
> > 
> > regards,
> > dan carpenter
> 
> _______________________________________________
> xfs mailing list
> xfs@oss.sgi.com
> http://oss.sgi.com/mailman/listinfo/xfs

_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-10-16 13:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20140219095305.GA22351@elgon.mountain>
2014-10-15 13:05 ` xfs: use after free on error in xfs_qm_log_quotaoff() Dan Carpenter
2014-10-16 13:28   ` Brian Foster

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox