* [PATCH] xfs: don't send null bp to xfs_trans_brelse()
@ 2014-06-10 22:13 Eric Sandeen
2014-06-12 15:00 ` Brian Foster
0 siblings, 1 reply; 2+ messages in thread
From: Eric Sandeen @ 2014-06-10 22:13 UTC (permalink / raw)
To: xfs-oss
In this case, if bp is null, error is set, and we send
bp to xfs_trans_brelse, which will try to dereference it.
Test whether we actualy have a buffer before we try to
free it.
Coverity spotted this.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
index 6cc5f67..41f7a42 100644
--- a/fs/xfs/xfs_da_btree.c
+++ b/fs/xfs/xfs_da_btree.c
@@ -2571,7 +2571,8 @@ xfs_da_get_buf(
mapp, nmap, 0);
error = bp ? bp->b_error : XFS_ERROR(EIO);
if (error) {
- xfs_trans_brelse(trans, bp);
+ if (bp)
+ xfs_trans_brelse(trans, bp);
goto out_free;
}
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] xfs: don't send null bp to xfs_trans_brelse()
2014-06-10 22:13 [PATCH] xfs: don't send null bp to xfs_trans_brelse() Eric Sandeen
@ 2014-06-12 15:00 ` Brian Foster
0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2014-06-12 15:00 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs-oss
On Tue, Jun 10, 2014 at 05:13:21PM -0500, Eric Sandeen wrote:
> In this case, if bp is null, error is set, and we send
> bp to xfs_trans_brelse, which will try to dereference it.
>
> Test whether we actualy have a buffer before we try to
> free it.
>
> Coverity spotted this.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
>
> diff --git a/fs/xfs/xfs_da_btree.c b/fs/xfs/xfs_da_btree.c
> index 6cc5f67..41f7a42 100644
> --- a/fs/xfs/xfs_da_btree.c
> +++ b/fs/xfs/xfs_da_btree.c
> @@ -2571,7 +2571,8 @@ xfs_da_get_buf(
> mapp, nmap, 0);
> error = bp ? bp->b_error : XFS_ERROR(EIO);
> if (error) {
> - xfs_trans_brelse(trans, bp);
> + if (bp)
> + xfs_trans_brelse(trans, bp);
> goto out_free;
> }
>
>
> _______________________________________________
> 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-06-12 15:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-10 22:13 [PATCH] xfs: don't send null bp to xfs_trans_brelse() Eric Sandeen
2014-06-12 15:00 ` Brian Foster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.