Re: [patch] xfsprogs: repair pagefault due to missed out sanity NULL check

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 28, 2011 at 08:13:04PM +0900, Ajeet Yadav wrote:
> libxfs_putbuf() is called with bp = NULL, resulting in pagefault in
> libpthread.
> 
> Function da_read_buf() allocate array of xfs_buf_t *
> 
>    * xfs_buf_t       **bplist;*
> 
> *    bplist = calloc(nex, sizeof(*bplist));*
> 
> Read and fill it using
> 
> *for (i = 0; i < nex; i++) {
>     bplist[i] = libxfs_readbuf()*
> 
> *    if (!bplist[i]){
>         goto failed;
>     }  *
> 
> *}*
> 
> *failed:
>         for (i = 0; i < nex; i++)
>                 libxfs_putbuf(bplist[i]);*
> 
> Now assume nex = 10,
> 
> 1. Will create bplist for 10 array elements.
> 
> 3. Reading from disk 0,1, 2, 3
> 
> 4. When reading from disk 4, USB is removed
> 
> 5. libxfs_readbuf() will at fail, pblist[4] = NULL, goto failed.
> 
> 6. Since only 4 buffers were read successfully, so only 4 are in lock state.
> 
> 7.  Error handling will unlock buffer from 1-10
> 
> 8. Buffer 0-3 were read successfully, hence will have valid pdlist[i]
> 
> 9. Access pblist[4] == NULL, therefore unlocking will set bp == NULL in
> libxfs_putbuf(bp);
> 10. Page fault in libpthread
> 
> 
> Solution patch attached with mail

Can you please include the patches in-line in your email rather than
as base64 encoded attachments? Even though it is for xfsprogs, we
ask that the same process is followed as per kernel patches. That
includes addÑng Signed-off-by tags to the patches...

See Documentation/SubmittingPatches:

| 7) No MIME, no links, no compression, no attachments.  Just plain text.
| 
| Linus and other kernel developers need to be able to read and comment
| on the changes you are submitting.  It is important for a kernel
| developer to be able to "quote" your changes, using standard e-mail
| tools, so that they may comment on specific portions of your code.
| 
| For this reason, all patches should be submitting e-mail "inline".
| WARNING:  Be wary of your editor's word-wrap corrupting your patch,
| if you choose to cut-n-paste your patch.
| 
| Do not attach the patch as a MIME attachment, compressed or not.
| Many popular e-mail applications will not always transmit a MIME
| attachment as plain text, making it impossible to comment on your
| code.  A MIME attachment also takes Linus a bit more time to process,
| decreasing the likelihood of your MIME-attached change being accepted.
| 
| Exception:  If your mailer is mangling patches then someone may ask
| you to re-send them using MIME.
| 
| See Documentation/email-clients.txt for hints about configuring
| your e-mail client so that it sends your patches untouched.

And as it suggests, read Documentation/email-clients.txt on how to
do this with various mail clients.

Cheers,

Dave.
-- 
Dave Chinner
david@xxxxxxxxxxxxx

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



[Index of Archives]     [Linux XFS Devel]     [Linux Filesystem Development]     [Filesystem Testing]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux