On Mon, Feb 20, 2017 at 07:25:06PM +0100, David Sterba wrote: > The space check in btrfs_insert_xattr_item is duplicated in it's caller > (do_setxattr) so we won't hit the BUG_ON. Continuing without any check > could be disasterous so turn it to a proper error handling. > > Signed-off-by: David Sterba <dste...@suse.com> > --- > fs/btrfs/dir-item.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/fs/btrfs/dir-item.c b/fs/btrfs/dir-item.c > index 724504a2d7ac..640801082533 100644 > --- a/fs/btrfs/dir-item.c > +++ b/fs/btrfs/dir-item.c > @@ -80,7 +80,8 @@ int btrfs_insert_xattr_item(struct btrfs_trans_handle > *trans, > struct extent_buffer *leaf; > u32 data_size; > > - BUG_ON(name_len + data_len > BTRFS_MAX_XATTR_SIZE(root->fs_info)); > + if (name_len + data_len > BTRFS_MAX_XATTR_SIZE(root->fs_info)) > + return -ENOSPC; >
Besides making it silent, how about adding a ASSERT to cry out? (Although currently we'd never come into this case.) Reviewed-by: Liu Bo <bo.li....@oracle.com> Thanks, -liubo > key.objectid = objectid; > key.type = BTRFS_XATTR_ITEM_KEY; > -- > 2.10.1 > > -- > To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html