[PATCH] btrfs: use after free in btrfs_quota_enable()

2018-08-20 Thread Dan Carpenter
d it leads to a use after free inside the btrfs_end_transaction() macro. Fixes: 340f1aa27f36 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index 4353bb69bb86..d4917c0cddf5

[PATCH] btrfs: dereferencing error pointer in btrfs_quota_enable()

2018-08-02 Thread Dan Carpenter
The error handling in "goto out;" expects that if "trans" is non-NULL that means it's valid. Unfortunately it could also be an error pointer. Fixes: c9a6fe84fe43 ("btrfs: qgroups: Move transaction management inside btrfs_quota_enable/disable") Signed-off-by: D

[bug report] btrfs: Add type check when reading a chunk

2018-07-19 Thread Dan Carpenter
| or perhaps check that both are set? 6389 btrfs_err(fs_info, 6390 "mixed chunk type in non-mixed mode: %llu", type); 6391 return -EIO; 6392 } 6393 } regards, dan carpenter -

[bug report] btrfs: add helper function check device delete able

2018-07-19 Thread Dan Carpenter
1885 return device; 1886 } See also: regards, dan carpenter -- 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

[PATCH] Btrfs: checking for NULL instead of IS_ERR

2018-05-31 Thread Dan Carpenter
memdup_user() returns error pointers, it doesn't return NULL. Fixes: 01141b08dee5 ("btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF") Signed-off-by: Dan Carpenter diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ff5018587bd9..d8dd4504bdab 100644 --- a/fs/btr

[bug report] btrfs: Add unprivileged version of ino_lookup ioctl

2018-05-30 Thread Dan Carpenter
goto out; 2483 } 2484 regards, dan carpenter -- 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

[bug report] btrfs: cleanup device states define BTRFS_DEV_STATE_IN_FS_METADATA

2017-12-08 Thread Dan Carpenter
75 btrfs_init_dev_replace() warn: test_bit() takes a bit number fs/btrfs/dev-replace.c:310 btrfs_dev_name() warn: test_bit() takes a bit number fs/btrfs/dev-replace.c:570 btrfs_dev_replace_finishing() warn: test_bit() takes a bit number regards, dan carpenter -- To unsubscribe from this list: send th

[PATCH] Btrfs: ref-verify: Fix NULL vs IS_ERR() check in walk_down_tree()

2017-10-18 Thread Dan Carpenter
read_tree_block() returns error pointers, and never NULL and so I have updated the error handling. Fixes: 74739121b4c7 ("Btrfs: add a extent ref verify tool") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/ref-verify.c b/fs/btrfs/ref-verify.c in

[bug report] btrfs: error out if btrfs_attach_transaction() fails

2017-10-12 Thread Dan Carpenter
2506 blkdev_put(bdev, FMODE_EXCL); 2507 if (seeding_dev && !unlocked) { 2508 mutex_unlock(_mutex); 2509 up_write(>s_umount); 2510 } 2511 return ret; 2512 } regards, dan carpenter -- To unsubscribe from this list

Re: [PATCH 4/5] btrfs: Use common error handling code in update_ref_path()

2017-08-21 Thread Dan Carpenter
said that a bunch of times. It's like bashing my face into the keyboard for all the good it does. On the other hand, some people accept these oddly placed labels... No one else writes code like this so far as I know. regards, dan carpenter -- To unsubscribe from this list: send the line "

Re: [PATCH 2/5] btrfs: Use common error handling code in __btrfs_free_extent()

2017-08-21 Thread Dan Carpenter
reviewing this and I missed that issue. These patches are just exhausting... regards, dan carpenter -- 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

[bug report] btrfs: get fs_info from eb in btrfs_print_leaf, remove argument

2017-07-19 Thread Dan Carpenter
return; 183 regards, dan carpenter -- 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

[bug report] Btrfs: replace tree->mapping with tree->private_data

2017-06-28 Thread Dan Carpenter
continue; 3422 } 3423 3424 set_range_writeback(tree, cur, cur + iosize - 1); The patch adds a new unchecked dereference. regards, dan carpenter -- To unsubscribe from this list: send the li

[PATCH] btrfs: use new block error code

2017-06-19 Thread Dan Carpenter
This function is supposed to return blk_status_t error codes now but there was a stray -ENOMEM left behind. Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/compression.c b/fs/btrfs/com

[PATCH] Btrfs: remove an unused variable

2017-05-02 Thread Dan Carpenter
"item" is never used. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1e4e4532f381..337aef86dae5 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -5881,7 +5881,6 @@ static int btrfs_real_readdir(struct fi

[PATCH] Btrfs: remove some dead code

2017-04-11 Thread Dan Carpenter
btrfs_get_extent() never returns NULL pointers, so this code introduces a static checker warning. The btrfs_get_extent() is a bit complex, but trust me that it doesn't return NULLs and also if it did we would trigger the BUG_ON(!em) before the last return statement. Signed-off-by: Dan Carpenter

[PATCH] Btrfs: fix an integer overflow check

2017-03-17 Thread Dan Carpenter
sctx->clone_roots = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN); Fixes: f5ecec3ce21f ("btrfs: send: silence an integer overflow warning") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/send.c b/fs/btrfs/send.c index 030d592ed1fe..ad9508e67

[patch] btrfs: white space cleanup in btrfs_log_inode()

2017-01-25 Thread Dan Carpenter
We accidentally deleted a new line in commit 0921910aa6fe ("btrfs: Make btrfs_log_inode take btrfs_inode") Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c index f1dc36a181db..010cf7685677 100644 --- a/fs/btrfs/tre

[bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables

2016-12-22 Thread Dan Carpenter
233 struct btrfs_key key; 234 int name_len; 235 int ret; 236 u64 ino; 237 238 if (!dir || !inode) ^ Old code checked for NULL. 239 return -EINVAL; 240 regards, dan carpenter --

[bug report] btrfs: Expoert and move leaf/subtree qgroup helpers to qgroup.c

2016-11-10 Thread Dan Carpenter
t_level] = 0; /* so release_path doesn't try to unlock */ 1685 walk_down: regards, dan carpenter -- 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

[patch] block: precedence bug in bio_set_op_attrs() macro

2016-11-10 Thread Dan Carpenter
This code causes a problem for flush_epd_write_bio() because | has higher precedence than ?: so it basically turns into: ((bio)->bi_opf |= REQ_SYNC; Which is wrong. Fixes: ef295ecf090d ("block: better op and flags encoding") Signed-off-by: Dan Carpenter <dan.carpen...@o

[patch] Btrfs: remove some no-op casts

2016-10-12 Thread Dan Carpenter
We cast 0 to a u8 but then because of type promotion, it's immediately cast to int back to int before we do a bitwise negate. The cast doesn't matter in this case, the code works as intended. It causes a static checker warning though so let's remove it. Signed-off-by: Dan Carpenter <dan.car

[bug report] btrfs: root->fs_info cleanup, add fs_info convenience variables

2016-07-08 Thread Dan Carpenter
truct btrfs_key key; 234 int name_len; 235 int ret; 236 u64 ino; 237 238 if (!dir || !inode) ^ Old code assumed it can be NULL. 239 return -EINVAL; 240 regards, dan carpenter -- To unsubsc

re: btrfs: fix check_shared for fiemap ioctl

2016-06-07 Thread Dan Carpenter
(node->ref_mod > 0) ^ Use after free. 278 ref_tree->unique_refs += origin_count > 0 ? 0 : 1; 279 else if (node->ref_mod <= 0) 280 ref_tree->unique_refs += origin_count > 0 ? -1 : 0; 281 282 return 0; re

[patch] btrfs: send: silence an integer overflow warning

2016-04-13 Thread Dan Carpenter
The "sizeof(*arg->clone_sources) * arg->clone_sources_count" expression can overflow. It causes several static checker warnings. It's all under CAP_SYS_ADMIN so it's not that serious but lets silence the warnings. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com>

Re: [PATCH] delete obsolete function btrfs_print_tree()

2016-04-04 Thread Dan Carpenter
uch a waste!" But we could use instead use___GFP_NOFAIL instead. Or BUG_ON(!foo)". I have gotten distracted. What was the question again? regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger

re: Btrfs: fix up read_tree_block to return proper error

2016-03-19 Thread Dan Carpenter
ee_lock(eb); ^^ Dereference. 1859 if (cow) { 1860 ret = btrfs_cow_block(trans, dest, eb, parent, 1861slot, ); regards, dan carpenter -- To unsubs

re: Btrfs: get/set for struct header fields

2016-03-19 Thread Dan Carpenter
rfs_header_level(next) != 363 level - 1) 364 BUG(); 365 btrfs_print_tree(root, next); 366 free_extent_buffer(next); 367 } regards, dan carpenter -- To unsubscribe from this list: send the line &qu

re: Btrfs: remove empty block groups automatically

2016-03-18 Thread Dan Carpenter
leaf = path->nodes[0]; 1477 btrfs_item_key_to_cpu(leaf, _key, path->slots[0]); 1478 extent = btrfs_item_ptr(leaf, path->slots[0], regards, dan carpenter -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs

[patch] btrfs: scrub: silence an uninitialized variable warning

2016-03-11 Thread Dan Carpenter
It's basically harmless if "ref_level" isn't initialized since it's only used for an error message, but it causes a static checker warning. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index e42aa27..39dbdcb 10064

[patch] btrfs: array overflow in btrfs_ioctl_rm_dev_v2()

2016-02-17 Thread Dan Carpenter
We were putting the NUL terminator at BTRFS_PATH_NAME_MAX (4087) bytes instead of BTRFS_SUBVOL_NAME_MAX (4039) so it corrupted memory. Fixes: 22af1a869288 ('btrfs: introduce device delete by devid') Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/ioctl.c b/fs

re: btrfs: reada: simplify dev->reada_in_flight processing

2016-02-17 Thread Dan Carpenter
} 702 re->scheduled = 1; 703 spin_unlock(>lock); 704 regards, dan carpenter -- 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

re: btrfs: extend balance filter usage to take minimum and maximum

2015-11-12 Thread Dan Carpenter
!(bctl->meta.flags & BTRFS_BALANCE_ARGS_CONVERT)) { Same. 3076 bctl->meta.flags |= BTRFS_BALANCE_ARGS_USAGE; 3077 bctl->meta.usage = 90; 3078 } 3079 } regards, dan carpenter -- 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

re: btrfs: add tracing for failed reservations

2015-11-10 Thread Dan Carpenter
reservation(root->fs_info, 4115"space_info:enospc", 4116data_sinfo->flags, bytes, 1); ^ Potential NULL deref. 4117 r

[patch] Btrfs: tests: checking for NULL instead of IS_ERR()

2015-11-10 Thread Dan Carpenter
btrfs_alloc_dummy_root() return an error pointer on failure, it never returns NULL. Signed-off-by: Dan Carpenter <dan.carpen...@oracle.com> diff --git a/fs/btrfs/tests/free-space-tests.c b/fs/btrfs/tests/free-space-tests.c index c8c3d70..8b72b00 100644 --- a/fs/btrfs/tests/free-space-t

re: btrfs: check unsupported filters in balance arguments

2015-10-21 Thread Dan Carpenter
info->balance_mutex); 4668 mutex_unlock(_info->volume_mutex); 4669 if (need_unlock) 4670 atomic_set(_info->mutually_exclusive_operation_running, 0); 4671 out: 4672 mnt_drop_write_file(file); 4673 return ret; 4674 } regar

re: Btrfs: don't start the log transaction if the log tree init fails

2015-08-14 Thread Dan Carpenter
; 182 } regards, dan carpenter -- 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

[patch] btrfs: delayed-ref: double free in btrfs_add_delayed_tree_ref()

2015-06-24 Thread Dan Carpenter
There is a cut and paste error so instead of freeing head_ref, we free ref twice. Fixes: 3368d001ba5d ('btrfs: qgroup: Record possible quota-related extent for qgroup.') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/delayed-ref.c b/fs/btrfs/delayed-ref.c index

re: Btrfs: make fsync work after cloning into a file

2015-03-20 Thread Dan Carpenter
)) { ^^ Or here. 6625 BUG(); 6626 if (!trans) { regards, dan carpenter -- 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

re: btrfs: qgroup: account shared subtrees during snapshot delete

2015-02-01 Thread Dan Carpenter
ret = -EIO; 7663 goto out; 7664 } 7665 7666 path-nodes[level] = eb; 7667 path-slots[level] = 0; 7668 regards, dan carpenter -- To unsubscribe from this list: send the line

[patch] Btrfs, scrub: uninitialized variable in scrub_extent_for_parity()

2014-12-12 Thread Dan Carpenter
The only way that ret is set is when we call scrub_pages_for_parity() so the skip to if (ret) test doesn't make sense and causes a static checker warning. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Static checker work. Not tested. There are some other valid looking warnings from

[patch] Btrfs: kfree()ing ERR_PTRs

2014-09-04 Thread Dan Carpenter
up being more complicated that way. It makes the code simpler to re-order the unwind so it's in the mirror order of the allocation and introduce some new error labels. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index de505d5..741b92b

Re: [patch] Btrfs: kfree()ing ERR_PTRs

2014-09-04 Thread Dan Carpenter
are modified by the call btrfs_ioctl_snap_create_transid(). I think you are mixing up ptr and *ptr so that's why you're confused. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org More majordomo

[patch] Btrfs: fix error code in btrfs_init_test_fs()

2014-06-20 Thread Dan Carpenter
We had intended to return a negative error code here, but we use the wrong variable so it returns success. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/tests/btrfs-tests.c b/fs/btrfs/tests/btrfs-tests.c index 9626252..8e7225f 100644 --- a/fs/btrfs/tests/btrfs

re: Btrfs: split up __extent_writepage to lower stack usage

2014-06-09 Thread Dan Carpenter
ret = 1; 4082 } 4083 return ret; 4084 } regards, dan carpenter -- 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

re: Btrfs: add optional integrity check code

2014-05-09 Thread Dan Carpenter
the answer. 1099 goto one_stack_frame_backwards; 1100 } 1101 1102 next_stack-i = -1; regards, dan carpenter -- To unsubscribe from this list: send the line

re: btrfs: allow mounting btrfs subvolumes with different ro/rw options

2014-04-14 Thread Dan Carpenter
) { 1204 /* FIXME: release vfsmount mnt ??*/ 1205 return ERR_PTR(r); 1206 } 1207 } 1208 } 1209 Also you forgot to Sign your patch. regards, dan carpenter

Re: btrfs: allow mounting btrfs subvolumes with different ro/rw options

2014-04-14 Thread Dan Carpenter
On Mon, Apr 14, 2014 at 06:17:05PM +0200, David Sterba wrote: On Mon, Apr 14, 2014 at 09:39:02AM -0400, Chris Mason wrote: On 04/14/2014 09:10 AM, Dan Carpenter wrote: Hello Harald Hoyer, The patch 0723a0473fb4: btrfs: allow mounting btrfs subvolumes with different ro/rw options

[patch] Btrfs: kmalloc() doesn't return an ERR_PTR

2014-03-28 Thread Dan Carpenter
The error handling was copy and pasted from memdup_user(). It should be checking for NULL obviously. Fixes: abccd00f8af2 ('btrfs: Fix 32/64-bit problem with BTRFS_SET_RECEIVED_SUBVOL ioctl') Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c

re: Btrfs: convert printk to btrfs_ and fix BTRFS prefix

2014-01-09 Thread Dan Carpenter
(). 299 function, line, vaf, errno, errstr); 300 va_end(args); regards, dan carpenter -- 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

re: btrfs: add tracing for failed reservations

2013-11-13 Thread Dan Carpenter
-flags, bytes, 1); ^ Patch introduces an unchecked dereference. 3711 return -ENOSPC; 3712 } regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body

[patch] btrfs/raid56: fix and cleanup some error paths

2013-07-22 Thread Dan Carpenter
(). Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c index 0525e13..0db856c 100644 --- a/fs/btrfs/raid56.c +++ b/fs/btrfs/raid56.c @@ -1687,11 +1687,8 @@ int raid56_parity_write(struct btrfs_root *root, struct bio *bio, struct

Re: [patch] btrfs/raid56: fix and cleanup some error paths

2013-07-22 Thread Dan Carpenter
On Mon, Jul 22, 2013 at 04:47:00PM +0800, Miao Xie wrote: On mon, 22 Jul 2013 09:55:15 +0300, Dan Carpenter wrote: The alloc_rbio() frees raid_map and bbio on error, so there is a potential double free bug in raid56_parity_write(). The raid56_parity_write() and raid56_parity_recover

re: Btrfs: cleanup destroy_marked_extents

2013-05-09 Thread Dan Carpenter
) ^^^ New check. Maybe we should be adding root-leafsize here? Just the check earlier would cause a forever loop. 3815 continue; 3816 wait_on_extent_buffer_writeback(eb); regards, dan carpenter

[patch] Btrfs: fix access_ok() check in btrfs_ioctl_send()

2013-01-10 Thread Dan Carpenter
The closing parenthesis is in the wrong place. We want to check sizeof(*arg-clone_sources) * arg-clone_sources_count instead of sizeof(*arg-clone_sources * arg-clone_sources_count). Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- This is also vulnerable to integer overflows. It's only

[josef-btrfs:master 21/21] fs/btrfs/ioctl.c:1436 btrfs_ioctl_resize() error: 'device' dereferencing possible ERR_PTR()

2012-12-20 Thread Dan Carpenter
[ get_avail_device() sometimes returns an ERR_PTR ] Hi Liu, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master head: 3d294381647ab114f525a0ccf3d28f8172ce6a5f commit: 3d294381647ab114f525a0ccf3d28f8172ce6a5f [21/21]

[josef-btrfs:master 105/117] fs/btrfs/tree-log.c:3401 log_one_extent() error: double unlock 'irq:'

2012-12-14 Thread Dan Carpenter
Hi Josef, FYI, there are new smatch warnings show up in tree: git://git.kernel.org/pub/scm/linux/kernel/git/josef/btrfs-next.git master head: 39a6066ac26f336b444c666a4b7339078ebf19b1 commit: 2d6d440d12fe503bc909f9f9e1fe8771d84f [105/117] Btrfs: wait on ordered extents at the last

Re: Btrfs: add support for multiple csum algorithms

2012-12-11 Thread Dan Carpenter
This is a memory corruption bug, could someone take a look at it? regards, dan carpetner On Fri, Jun 15, 2012 at 10:49:22PM +0300, Dan Carpenter wrote: Hello Josef Bacik, The patch 607d432da054: Btrfs: add support for multiple csum algorithms from Dec 2, 2008, leads to the following

[patch] Btrfs: fix some endian bugs handling the root times

2012-07-30 Thread Dan Carpenter
trans-transid is cpu endian but we want to store the data as little endian. item-ctime.nsec is only 32 bits, not 64. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Applies to linux-next. diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 43f0012..a1fbca0 100644 --- a/fs/btrfs

[patch 1/2] Btrfs: checking for NULL instead of IS_ERR

2012-07-30 Thread Dan Carpenter
add_qgroup_rb() never returns NULL, only error pointers. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Applies to linux-next. diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index bc424ae..b650155 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1364,8 +1364,10 @@ int

[patch 2/2] Btrfs: fix some error codes in btrfs_qgroup_inherit()

2012-07-30 Thread Dan Carpenter
These are returning zero when it should be returning a negative error code. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Applies to linux-next. diff --git a/fs/btrfs/qgroup.c b/fs/btrfs/qgroup.c index b650155..38b42e7 100644 --- a/fs/btrfs/qgroup.c +++ b/fs/btrfs/qgroup.c @@ -1371,8

Re: [patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-26 Thread Dan Carpenter
it to marc.info without getting corrupted. Marc.info strips out the From: and Subject: headers so you'd have to add them in manually. 1) Save this file: http://marc.info/?l=kernel-janitorsm=134062314509635q=raw 2) Edit the file and add these two lines add the top: From: Dan Carpenter dan.carpen

[patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-25 Thread Dan Carpenter
We dereferenced node in the error message after freeing it. Also btrfs_panic() can return so we should return an error code instead of continuing. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: in the first version I just deleted the kfree(). diff --git a/fs/btrfs/relocation.c b

Re: [patch v2] Btrfs: fix error handling in __add_reloc_root()

2012-06-25 Thread Dan Carpenter
On Mon, Jun 25, 2012 at 09:41:12AM -0400, Josef Bacik wrote: On Mon, Jun 25, 2012 at 05:15:23AM -0600, Dan Carpenter wrote: We dereferenced node in the error message after freeing it. Also btrfs_panic() can return so we should return an error code instead of continuing. Signed-off

[report] NULL dereference in __update_reloc_root()

2012-06-22 Thread Dan Carpenter
. 1285 } 1286 return 0; regards, dan carpenter -- 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

[patch] Btrfs: dereferencing free'd memory in panic message

2012-06-22 Thread Dan Carpenter
We free node and then dereference it in the panic message on the next line. I considered moving the kfree() after the panic given that panic can return under certain configurations, but in the end I decided it doesn't matter if we leak a bit after a panic. Signed-off-by: Dan Carpenter dan.carpen

Re: [patch] Btrfs: dereferencing free'd memory in panic message

2012-06-22 Thread Dan Carpenter
On Fri, Jun 22, 2012 at 09:09:04AM -0400, Josef Bacik wrote: On 06/22/2012 03:14 AM, Dan Carpenter wrote: We free node and then dereference it in the panic message on the next line. I considered moving the kfree() after the panic given that panic can return under certain configurations

[patch] Btrfs: small naming cleanup in join_transaction()

2012-06-19 Thread Dan Carpenter
root-fs_info and fs_info are the same, but fs_info is prefered because it is shorter and that's what is used in the rest of the function. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Also, Smatch doesn't understand that they are the same so it complains about the locking. diff --git

re: Btrfs: fix locking in btrfs_destroy_delayed_refs

2012-06-18 Thread Dan Carpenter
it. Sorry, if I've misread something. regards, dan carpenter -- 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

re: Btrfs: add support for multiple csum algorithms

2012-06-15 Thread Dan Carpenter
if (result != (char *)inline_result) 308 kfree(result); 309 return 1; regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord...@vger.kernel.org

re: btrfs: initial readahead code and prototypes

2012-05-17 Thread Dan Carpenter
generation = btrfs_header_generation(eb); ^^^ Dereferenced inside function without checking. 148 /* 149 * FIXME: currently we just set nritems to 0 if this is a leaf, regards, dan carpenter

Re: btrfs: initial readahead code and prototypes

2012-05-17 Thread Dan Carpenter
. This code changes significantly with the patch btrfs: extend readahead interface Where it is written in a more obvious way. Cool. regards, dan carpenter -- 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

re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
, 1); + if (ret == 1) + kref_get(zone-refcnt); } + spin_unlock(fs_info-reada_lock); return zone; } regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord

Re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
On Mon, Apr 30, 2012 at 01:23:29PM +0200, Arne Jansen wrote: On 30.04.2012 13:11, Dan Carpenter wrote: Hello Arne Jansen, The patch 8c9c2bf7a3c4: btrfs: fix race in reada from Feb 25, 2012, leads to the following warning: fs/btrfs/reada.c:308 reada_find_zone() warn: 'zone

Re: btrfs: fix race in reada

2012-04-30 Thread Dan Carpenter
On Mon, Apr 30, 2012 at 01:23:29PM +0200, Arne Jansen wrote: On 30.04.2012 13:11, Dan Carpenter wrote: Hello Arne Jansen, The patch 8c9c2bf7a3c4: btrfs: fix race in reada from Feb 25, 2012, leads to the following warning: fs/btrfs/reada.c:308 reada_find_zone() warn: 'zone

[patch 1/2] Btrfs: double unlock bug in error handling

2012-04-18 Thread Dan Carpenter
The caller expects this function to return with the lock held and releases it immediately on error. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 2b35f8d..a0bb9dc 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent

[patch 2/2] Btrfs: cleanup: use consistent lock naming

2012-04-18 Thread Dan Carpenter
It confuses Smatch that we use two names for the same lock. Plus the shorter name is nicer. This doesn't change how the code works, it's just a cleanup. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index a0bb9dc..29c0445

Re: [patch 1/2] Btrfs: double unlock bug in error handling

2012-04-18 Thread Dan Carpenter
On Wed, Apr 18, 2012 at 01:29:46PM +0200, Jan Schmidt wrote: On 18.04.2012 08:59, Dan Carpenter wrote: I think the correct way to fix this is: Yeah. I considered both ways, but I chose the one which makes the tools happy. Which is the wrong choice, because taking a pointless lock is wrong

re: btrfs: enhance transaction abort infrastructure

2012-04-02 Thread Dan Carpenter
-fs_info-reloc_mutex); before these two gotos? 1414 } regards, dan carpenter -- 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

Re: btrfs: enhance transaction abort infrastructure

2012-04-02 Thread Dan Carpenter
On Mon, Apr 02, 2012 at 12:46:44PM +0200, David Sterba wrote: Thanks for cathing it. Are you going to send a patch or are you fine with a Reported-by: ? You're welcome. :) Reported-by is fine. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux

Re: [patch] Btrfs: silence a compiler warning

2012-02-22 Thread Dan Carpenter
On Wed, Feb 22, 2012 at 08:29:26AM -0800, David Brown wrote: On Wed, Feb 22, 2012 at 10:30:55AM +0300, Dan Carpenter wrote: Gcc warns that ret can be used uninitialized. It can't actually be used uninitialized because btrfs_num_copies() always returns 1 or more. Signed-off-by: Dan Carpenter

[patch v2] Btrfs: silence a compiler warning

2012-02-22 Thread Dan Carpenter
Gcc warns that ret can be used uninitialized. It can't actually be used uninitialized because btrfs_num_copies() always returns 1 or more. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- v2: use the uninitialized_var() macro instead of initializing to 0. diff --git a/fs/btrfs/check

[patch] Btrfs: silence a compiler warning

2012-02-21 Thread Dan Carpenter
Gcc warns that ret can be used uninitialized. It can't actually be used uninitialized because btrfs_num_copies() always returns 1 or more. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c index 064b29b..c053e90 100644

passing positive numbers to ERR_PTR()

2012-02-08 Thread Dan Carpenter
be either a negative error code, zero, or one here. 921 I looked at the code, but couldn't tell if it was intentional or not. It really is pretty unusual to do that, so maybe there should be a comment or something. regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe

[patch] Btrfs: fix bitwise vs logical condition

2012-01-19 Thread Dan Carpenter
The intent here was to do a logical instead of a bitwise . The original condition tests whether they have the some of same bits set. I have fixed that and rewritten it to be more clear. Signed-off-by: Dan Carpenter dan.carpen...@oracle.com --- Warning: This is a static analysis bug and I'm

[patch] Btrfs: use gfp_t to silence a sparse warning

2012-01-19 Thread Dan Carpenter
These should be gfp_t or Sparse complains: fs/btrfs/ulist.c:100:55: warning: incorrect type in argument 2 (different base types) Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/ulist.c b/fs/btrfs/ulist.c index 12f5147..5d1b047 100644 --- a/fs/btrfs/ulist.c

re: Btrfs: fix num_workers_starting bug and other bugs in async thread

2011-12-23 Thread Dan Carpenter
() instead of spin_lock_irq(). regards, dan carpenter -- 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

[patch] btrfs scrub: handle -ENOMEM from init_ipath()

2011-11-16 Thread Dan Carpenter
init_ipath() can return an ERR_PTR(-ENOMEM). Signed-off-by: Dan Carpenter dan.carpen...@oracle.com diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c index ed11d38..b72ee47 100644 --- a/fs/btrfs/scrub.c +++ b/fs/btrfs/scrub.c @@ -256,6 +256,11 @@ static int scrub_print_warning_inode(u64 inum, u64

smatch stuff: potential NULL dereference in btrfs_rm_device()

2011-11-08 Thread Dan Carpenter
here. If we don't hit the break statement, then at the end of the loop we'd oops. regards, dan carpenter -- 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

[patch] btrfs: memory leak in btrfs_add_inode_defrag()

2011-08-05 Thread Dan Carpenter
We don't use the defrag struct on this path. Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 658d669..1102059 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -150,6 +150,8 @@ int btrfs_add_inode_defrag(struct btrfs_trans_handle *trans

[patch] btrfs: unlock on error in btrfs_file_llseek()

2011-07-27 Thread Dan Carpenter
There were some unlocks on error missing in a recent patch to btrfs_file_llseek(). Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 59cbdb1..94d8342 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -1804,10 +1804,14 @@ static loff_t

[patch] btrfs: make code reachable in btrfs_insert_some_items()

2010-06-28 Thread Dan Carpenter
The break was in front of the nr = i assignment so that was never hit. Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 0d1d966..ceb8ad2 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c @@ -3453,8 +3453,8 @@ int btrfs_insert_some_items

Re: [patch 11/11] btrfs: The file argument for fsync() is never null

2010-06-14 Thread Dan Carpenter
? That introduces a dereference at the start of the function. Sorry about this. I didn't take back porting into consideration. regards, dan carpenter -- 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

Re: [patch 11/11] btrfs: The file argument for fsync() is never null

2010-06-14 Thread Dan Carpenter
sure you have a recent enough kernel. This actually was merged into the btrfs and the kernel.org trees already. I'm not sure how the btrfs backports work... regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message to majord

[patch] btrfs: uninitialized data is check_path_shared()

2010-06-01 Thread Dan Carpenter
please look it over carefully. Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index fa6ccc1..9640dae 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -2673,7 +2673,7 @@ static int check_path_shared(struct btrfs_root *root, struct

Re: [patch 5/11] btrfs: remove unneeded null check in btrfs_rename()

2010-05-31 Thread Dan Carpenter
On Sat, May 29, 2010 at 11:01:56AM -0700, Mike Fedyk wrote: On Sat, May 29, 2010 at 2:45 AM, Dan Carpenter erro...@gmail.com wrote: old_inode cannot be null here, because we dereference it unconditionally throughout the function. Signed-off-by: Dan Carpenter erro...@gmail.com diff

Re: [PATCH] btrfs: Fix null dereference in relocation.c

2010-05-31 Thread Dan Carpenter
On Mon, May 31, 2010 at 04:58:47PM +0800, Yan, Zheng wrote: Fix a potential null dereference in relocation.c Thanks for that. Acked-by: Dan Carpenter erro...@gmail.com regards, dan carpenter -- To unsubscribe from this list: send the line unsubscribe linux-btrfs in the body of a message

potential null derefs in fs/btrfs/relocation.c

2010-05-29 Thread Dan Carpenter
); ^^ if tree_search() returns NULL it will oops here. regards, dan carpenter -- 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

[patch 1/11] btrfs: handle error returns from btrfs_lookup_dir_item()

2010-05-29 Thread Dan Carpenter
If btrfs_lookup_dir_item() fails, we should can just let the mount fail with an error. Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index d34b2df..28b53f1 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -360,6 +360,8 @@ static struct

[patch 3/11] btrfs: handle kzalloc() failure in open_ctree()

2010-05-29 Thread Dan Carpenter
Unwind and return -ENOMEM if the allocation fails here. Signed-off-by: Dan Carpenter erro...@gmail.com diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f3b287c..73895ba 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1941,8 +1941,11 @@ struct btrfs_root *open_ctree(struct

  1   2   >