mirror of https://github.com/torvalds/linux.git
When people set a writeback percent via sysfs file, /sys/block/bcache<N>/bcache/writeback_percent current code directly sets BCACHE_DEV_WB_RUNNING to dc->disk.flags and schedules kworker dc->writeback_rate_update. If there is no cache set attached to, the writeback kernel thread is not running indeed, running dc->writeback_rate_update does not make sense and may cause NULL pointer deference when reference cache set pointer inside update_writeback_rate(). This patch checks whether the cache set point (dc->disk.c) is NULL in sysfs interface handler, and only set BCACHE_DEV_WB_RUNNING and schedule dc->writeback_rate_update when dc->disk.c is not NULL (it means the cache device is attached to a cache set). This problem might be introduced from initial bcache commit, but commit |
||
|---|---|---|
| .. | ||
| Kconfig | ||
| Makefile | ||
| alloc.c | ||
| bcache.h | ||
| bset.c | ||
| bset.h | ||
| btree.c | ||
| btree.h | ||
| closure.c | ||
| closure.h | ||
| debug.c | ||
| debug.h | ||
| extents.c | ||
| extents.h | ||
| io.c | ||
| journal.c | ||
| journal.h | ||
| movinggc.c | ||
| request.c | ||
| request.h | ||
| stats.c | ||
| stats.h | ||
| super.c | ||
| sysfs.c | ||
| sysfs.h | ||
| trace.c | ||
| util.c | ||
| util.h | ||
| writeback.c | ||
| writeback.h | ||