Re: [bug report] bcachefs: Kill opts.buckets_nouse

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Le 31/07/2024 à 00:23, Kent Overstreet a écrit :
On Tue, Jul 30, 2024 at 02:45:17PM GMT, Dan Carpenter wrote:
Hello Kent Overstreet,

Commit ffcbec607613 ("bcachefs: Kill opts.buckets_nouse") from Apr 6,
2024 (linux-next), leads to the following Smatch static checker
warning:

	fs/bcachefs/super.c:1202 bch2_dev_free()
	warn: 'ca->buckets_nouse' double freed

yup, that's a bug

-- >8 --
Subject: [PATCH] bcachefs: Fix double free of ca->buckets_nouse

Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
Fixes: ffcbec6076 ("bcachefs: Kill opts.buckets_nouse")
Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>

diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 0542953a7a..6d0ce3d734 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1195,7 +1195,6 @@ static void bch2_dev_free(struct bch_dev *ca)
  	if (ca->kobj.state_in_sysfs)
  		kobject_del(&ca->kobj);
- kfree(ca->buckets_nouse);

Hi,

unrelated, but apparently this should also have been kvfree().

Dan, do you already have a check for such cases where kvfree() or kfree() are called when the other one should be used instead?

CJ

  	bch2_free_super(&ca->disk_sb);
  	bch2_dev_allocator_background_exit(ca);
  	bch2_dev_journal_exit(ca);







[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux