From: Dave Chinner <david@fromorbit.com>
To: Vivek Trivedi <t.vivek@samsung.com>
Cc: a.sahrawat@samsung.com, pankaj.m@samsung.com, xfs@oss.sgi.com
Subject: Re: [PATCH 10/11] xfsprogs: fix possible null pointer dereference in xfs_iformat_extents
Date: Thu, 3 Dec 2015 17:31:06 +1100 [thread overview]
Message-ID: <20151203063106.GZ26718@dastard> (raw)
In-Reply-To: <1449055167-19936-11-git-send-email-t.vivek@samsung.com>
On Wed, Dec 02, 2015 at 04:49:26PM +0530, Vivek Trivedi wrote:
> Fix possible null pointer dereference in xfs_iformat_extents and
> xfs_iext_get_ext if fail to locate inode record.
> Reported by coverity.
ignore it. Code
>
> Signed-off-by: Vivek Trivedi <t.vivek@samsung.com>
> ---
> libxfs/xfs_inode_fork.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/libxfs/xfs_inode_fork.c b/libxfs/xfs_inode_fork.c
> index e1968b4..36aa0c8 100644
> --- a/libxfs/xfs_inode_fork.c
> +++ b/libxfs/xfs_inode_fork.c
> @@ -331,6 +331,8 @@ xfs_iformat_extents(
> xfs_validate_extents(ifp, nex, XFS_EXTFMT_INODE(ip));
> for (i = 0; i < nex; i++, dp++) {
> xfs_bmbt_rec_host_t *ep = xfs_iext_get_ext(ifp, i);
> + if (!ep)
> + return -EFSCORRUPTED;
> ep->l0 = get_unaligned_be64(&dp->l0);
> ep->l1 = get_unaligned_be64(&dp->l1);
Can't possibly happen, as nex is a count of the number of entries in
the extent list and so we will never overrun the list here.
> @@ -890,6 +892,8 @@ xfs_iext_get_ext(
> xfs_extnum_t page_idx = idx; /* ext index in target list */
>
> erp = xfs_iext_idx_to_irec(ifp, &page_idx, &erp_idx, 0);
> + if (!erp)
> + return NULL;
Same again - this is guaranteed to succeed because the indexes
passed into the function are bound to within range by the caller.
The ASSERT()s at the beginning of the function enforce this....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
next prev parent reply other threads:[~2015-12-03 6:31 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-02 11:19 [PATCH 00/11] xfsprogs misc fixes Vivek Trivedi
2015-12-02 11:19 ` [PATCH 01/11] xfsprogs: xfs_io: fix a memory leak in imap_f Vivek Trivedi
2015-12-02 17:55 ` Eric Sandeen
2015-12-02 11:19 ` [PATCH 02/11] xfsprogs: fix integer overflow in xlog_find_verify_cycle Vivek Trivedi
2015-12-02 17:58 ` Eric Sandeen
2015-12-03 5:49 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 03/11] xfsprogs: mkfs: fix unintentional integer overflow Vivek Trivedi
2015-12-03 3:34 ` Eric Sandeen
2015-12-03 5:54 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 04/11] xfsprogs: xfsdb: remove unnessary checks in process_leaf_node_dir_v2_free Vivek Trivedi
2015-12-03 5:57 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 05/11] xfsprogs: xfs_mdrestore: check bad read count in perform_restore Vivek Trivedi
2015-12-03 4:54 ` Eric Sandeen
2015-12-03 5:59 ` Dave Chinner
2015-12-03 6:05 ` Eric Sandeen
2015-12-02 11:19 ` [PATCH 06/11] xfsprogs: xfs_db: check null derefernce after block_to_bt Vivek Trivedi
2015-12-03 5:43 ` Eric Sandeen
2015-12-02 11:19 ` [PATCH 07/11] xfsprogs: xfs_fsr: replace sprintf with snprintf to avoid buffer overflow Vivek Trivedi
2015-12-03 5:44 ` Eric Sandeen
2015-12-03 6:07 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 08/11] xfsprogs: xfs_repair: fix possible null dereference in build_ino_tree Vivek Trivedi
2015-12-03 6:19 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 09/11] xfsprogs: xfs_repair: fix possible null dereference in traverse_int_dir2block Vivek Trivedi
2015-12-03 5:51 ` Eric Sandeen
2015-12-03 6:22 ` Dave Chinner
2015-12-02 11:19 ` [PATCH 10/11] xfsprogs: fix possible null pointer dereference in xfs_iformat_extents Vivek Trivedi
2015-12-03 6:31 ` Dave Chinner [this message]
2015-12-02 11:19 ` [PATCH 11/11] xfsprogs: xfs_repair: fix possible null pointer dereference in mark_standalone_inodes Vivek Trivedi
2015-12-03 6:34 ` Dave Chinner
2015-12-02 15:10 ` [PATCH 00/11] xfsprogs misc fixes Eric Sandeen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20151203063106.GZ26718@dastard \
--to=david@fromorbit.com \
--cc=a.sahrawat@samsung.com \
--cc=pankaj.m@samsung.com \
--cc=t.vivek@samsung.com \
--cc=xfs@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox