summaryrefslogtreecommitdiff
path: root/fs/super.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2021-01-09 13:42:50 +0300
committerJens Axboe <axboe@kernel.dk>2021-01-25 04:15:57 +0300
commit6f0d9689b670bc9f9640ff87b3f9226b7806dea2 (patch)
tree56428c55621af77d28f43ad7545416d6b2fb4218 /fs/super.c
parent1e0dcca9e1aa3caa1a0dc4300db1a091078fe40b (diff)
downloadlinux-6f0d9689b670bc9f9640ff87b3f9226b7806dea2.tar.xz
block: remove the NULL bdev check in bdev_read_only
Only a single caller can end up in bdev_read_only, so move the check there. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Ming Lei <ming.lei@redhat.com> Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com> Reviewed-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/super.c b/fs/super.c
index 2c6cdea2ab2d..5a1f384ffc74 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -865,7 +865,8 @@ int reconfigure_super(struct fs_context *fc)
if (fc->sb_flags_mask & SB_RDONLY) {
#ifdef CONFIG_BLOCK
- if (!(fc->sb_flags & SB_RDONLY) && bdev_read_only(sb->s_bdev))
+ if (!(fc->sb_flags & SB_RDONLY) && sb->s_bdev &&
+ bdev_read_only(sb->s_bdev))
return -EACCES;
#endif