* [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode.
@ 2019-03-29 7:12 Qu Wenruo
2019-03-29 7:21 ` Nikolay Borisov
2019-03-29 15:19 ` David Sterba
0 siblings, 2 replies; 3+ messages in thread
From: Qu Wenruo @ 2019-03-29 7:12 UTC (permalink / raw)
To: linux-btrfs
We should check the inode validation before checking the imode.
As btrfs_iget() could return ERR_PTR(), unlike previous path, we need to
verify the inode before checking the imode.
Signed-off-by: Qu Wenruo <wqu@suse.com>
---
To David:
Please fold this into 9944a5b5d26e ("btrfs: inode: Verify inode mode to avoid NULL pointer dereference")
of misc-next branch.
---
fs/btrfs/inode.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 3ee835cbb490..97f47dd295e8 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -5776,6 +5776,8 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
if (location.type == BTRFS_INODE_ITEM_KEY) {
inode = btrfs_iget(dir->i_sb, &location, root, NULL);
+ if (IS_ERR(inode))
+ return inode;
/* Do extra check against inode mode with di_type */
if (btrfs_inode_type(inode) != di_type) {
--
2.21.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode.
2019-03-29 7:12 [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode Qu Wenruo
@ 2019-03-29 7:21 ` Nikolay Borisov
2019-03-29 15:19 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: Nikolay Borisov @ 2019-03-29 7:21 UTC (permalink / raw)
To: Qu Wenruo, linux-btrfs
On 29.03.19 г. 9:12 ч., Qu Wenruo wrote:
> We should check the inode validation before checking the imode.
>
> As btrfs_iget() could return ERR_PTR(), unlike previous path, we need to
> verify the inode before checking the imode.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> To David:
>
> Please fold this into 9944a5b5d26e ("btrfs: inode: Verify inode mode to avoid NULL pointer dereference")
> of misc-next branch.
> ---
> fs/btrfs/inode.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> index 3ee835cbb490..97f47dd295e8 100644
> --- a/fs/btrfs/inode.c
> +++ b/fs/btrfs/inode.c
> @@ -5776,6 +5776,8 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
>
> if (location.type == BTRFS_INODE_ITEM_KEY) {
> inode = btrfs_iget(dir->i_sb, &location, root, NULL);
> + if (IS_ERR(inode))
> + return inode;
>
> /* Do extra check against inode mode with di_type */
> if (btrfs_inode_type(inode) != di_type) {
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode.
2019-03-29 7:12 [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode Qu Wenruo
2019-03-29 7:21 ` Nikolay Borisov
@ 2019-03-29 15:19 ` David Sterba
1 sibling, 0 replies; 3+ messages in thread
From: David Sterba @ 2019-03-29 15:19 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs
On Fri, Mar 29, 2019 at 03:12:59PM +0800, Qu Wenruo wrote:
> We should check the inode validation before checking the imode.
>
> As btrfs_iget() could return ERR_PTR(), unlike previous path, we need to
> verify the inode before checking the imode.
>
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> ---
> To David:
>
> Please fold this into 9944a5b5d26e ("btrfs: inode: Verify inode mode to avoid NULL pointer dereference")
> of misc-next branch.
Folded and branch pushed, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-29 15:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-29 7:12 [PATCH] btrfs: inode: Check if we get a valid inode before checking its mode Qu Wenruo
2019-03-29 7:21 ` Nikolay Borisov
2019-03-29 15:19 ` David Sterba
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.