xfs: Fix error code in 'xfs_ioc_getbmap()'
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Mon, 4 Feb 2019 16:54:20 +0000 (08:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 18:47:20 +0000 (19:47 +0100)
commitb6095cbd7841fff310c1ad135ae2c7da14df9da4
treee30939ff6ad23e81b3a95a1b3a06de2b91a183f8
parenta585ac0e767b26e74b0156f014331b48b56f0974
xfs: Fix error code in 'xfs_ioc_getbmap()'

commit 132bf6723749f7219c399831eeb286dbbb985429 upstream.

In this function, once 'buf' has been allocated, we unconditionally
return 0.
However, 'error' is set to some error codes in several error handling
paths.
Before commit 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
this was not an issue because all error paths were returning directly,
but now that some cleanup at the end may be needed, we must propagate the
error code.

Fixes: 232b51948b99 ("xfs: simplify the xfs_getbmap interface")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/xfs/xfs_ioctl.c