[bug report] bcachefs: Kill opts.buckets_nouse

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

 



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

fs/bcachefs/super.c
    1185 static void bch2_dev_free(struct bch_dev *ca)
    1186 {
    1187         cancel_work_sync(&ca->io_error_work);
    1188 
    1189         if (ca->kobj.state_in_sysfs &&
    1190             ca->disk_sb.bdev)
    1191                 sysfs_remove_link(bdev_kobj(ca->disk_sb.bdev), "bcachefs");
    1192 
    1193         if (ca->kobj.state_in_sysfs)
    1194                 kobject_del(&ca->kobj);
    1195 
    1196         kfree(ca->buckets_nouse);
                       ^^^^^^^^^^^^^^^^^
The patch adds a free

    1197         bch2_free_super(&ca->disk_sb);
    1198         bch2_dev_allocator_background_exit(ca);
    1199         bch2_dev_journal_exit(ca);
    1200 
    1201         free_percpu(ca->io_done);
--> 1202         bch2_dev_buckets_free(ca);
                                       ^^
The existing code already freed ca->buckets_nouse.

    1203         free_page((unsigned long) ca->sb_read_scratch);
    1204 
    1205         bch2_time_stats_quantiles_exit(&ca->io_latency[WRITE]);
    1206         bch2_time_stats_quantiles_exit(&ca->io_latency[READ]);
    1207 
    1208         percpu_ref_exit(&ca->io_ref);
    1209 #ifndef CONFIG_BCACHEFS_DEBUG
    1210         percpu_ref_exit(&ca->ref);
    1211 #endif
    1212         kobject_put(&ca->kobj);

regards,
dan carpenter




[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