diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2022-01-02 21:45:35 -0500 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:21 -0400 |
commit | eacb2574f09f5b71acc468d44e7a1633847fd08d (patch) | |
tree | 75687f60a2545798197e1821fc526d9c7bf464dd /fs/bcachefs/chardev.c | |
parent | d8601afca840d36203d0cf2da94ce4f92003956e (diff) | |
download | linux-stable-eacb2574f09f5b71acc468d44e7a1633847fd08d.tar.gz linux-stable-eacb2574f09f5b71acc468d44e7a1633847fd08d.tar.bz2 linux-stable-eacb2574f09f5b71acc468d44e7a1633847fd08d.zip |
bcachefs: bch_dev->dev
Add a field to bch_dev for the dev_t of the underlying block device -
this fixes a null ptr deref in tracepoints.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/chardev.c')
-rw-r--r-- | fs/bcachefs/chardev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c index aae9a2db8b0d..6cd0a2739ce5 100644 --- a/fs/bcachefs/chardev.c +++ b/fs/bcachefs/chardev.c @@ -568,8 +568,11 @@ static long bch2_ioctl_disk_get_idx(struct bch_fs *c, if (!capable(CAP_SYS_ADMIN)) return -EPERM; + if (!dev) + return -EINVAL; + for_each_online_member(ca, c, i) - if (ca->disk_sb.bdev->bd_dev == dev) { + if (ca->dev == dev) { percpu_ref_put(&ca->io_ref); return i; } |