summaryrefslogtreecommitdiffstats
path: root/fs/pstore
diff options
context:
space:
mode:
authorKees Cook <keescook@chromium.org>2021-06-15 17:40:04 +0200
committerKees Cook <keescook@chromium.org>2021-06-16 17:19:37 +0200
commit6eed261f48d5a53f369c88d4296621f2d8647493 (patch)
tree9fb97f0bff3a4c9f9a3da5972805d69628ffe425 /fs/pstore
parentLinux 5.13-rc2 (diff)
downloadlinux-6eed261f48d5a53f369c88d4296621f2d8647493.tar.xz
linux-6eed261f48d5a53f369c88d4296621f2d8647493.zip
pstore/blk: Improve failure reporting
There was no feedback on bad registration attempts. Add details on the failure cause. Cc: Anton Vorontsov <anton@enomsg.org> Cc: Colin Cross <ccross@android.com> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Kees Cook <keescook@chromium.org>
Diffstat (limited to 'fs/pstore')
-rw-r--r--fs/pstore/blk.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index 4bb8a344957a..eca83820fb5d 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -114,8 +114,22 @@ static int __register_pstore_device(struct pstore_device_info *dev)
lockdep_assert_held(&pstore_blk_lock);
- if (!dev || !dev->total_size || !dev->read || !dev->write)
+ if (!dev) {
+ pr_err("NULL device info\n");
return -EINVAL;
+ }
+ if (!dev->total_size) {
+ pr_err("zero sized device\n");
+ return -EINVAL;
+ }
+ if (!dev->read) {
+ pr_err("no read handler for device\n");
+ return -EINVAL;
+ }
+ if (!dev->write) {
+ pr_err("no write handler for device\n");
+ return -EINVAL;
+ }
/* someone already registered before */
if (pstore_zone_info)