* [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap
@ 2021-08-30 12:10 Jeff Layton
2021-08-30 13:01 ` Xiubo Li
0 siblings, 1 reply; 2+ messages in thread
From: Jeff Layton @ 2021-08-30 12:10 UTC (permalink / raw)
To: ceph-devel; +Cc: pdonnell, idryomov, xiubli
Commit ba5e57de7b20 (ceph: reconnect to the export targets on new
mdsmaps) changed ceph_mdsmap_decode to "goto corrupt" when given a
bogus mds rank in the export targets. It did not set the err variable
however, which caused that function to return a NULL pointer instead of
a proper ERR_PTR value for the error.
Fix this by setting err before doing the "goto corrupt".
URL: https://tracker.ceph.com/issues/52436
Fixes: ba5e57de7b20 ("ceph: reconnect to the export targets on new mdsmaps")
Signed-off-by: Jeff Layton <jlayton@kernel.org>
---
fs/ceph/mdsmap.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
I'll plan to fold this change into the original patch since it hasn't
been merged yet. Let me know if you have objections.
diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
index d995cb02d30c..61d67cbcb367 100644
--- a/fs/ceph/mdsmap.c
+++ b/fs/ceph/mdsmap.c
@@ -263,8 +263,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
goto nomem;
for (j = 0; j < num_export_targets; j++) {
target = ceph_decode_32(&pexport_targets);
- if (target >= m->possible_max_rank)
+ if (target >= m->possible_max_rank) {
+ err = -EIO;
goto corrupt;
+ }
info->export_targets[j] = target;
}
} else {
--
2.31.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap
2021-08-30 12:10 [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap Jeff Layton
@ 2021-08-30 13:01 ` Xiubo Li
0 siblings, 0 replies; 2+ messages in thread
From: Xiubo Li @ 2021-08-30 13:01 UTC (permalink / raw)
To: Jeff Layton, ceph-devel; +Cc: pdonnell, idryomov
On 8/30/21 8:10 PM, Jeff Layton wrote:
> Commit ba5e57de7b20 (ceph: reconnect to the export targets on new
> mdsmaps) changed ceph_mdsmap_decode to "goto corrupt" when given a
> bogus mds rank in the export targets. It did not set the err variable
> however, which caused that function to return a NULL pointer instead of
> a proper ERR_PTR value for the error.
>
> Fix this by setting err before doing the "goto corrupt".
>
> URL: https://tracker.ceph.com/issues/52436
> Fixes: ba5e57de7b20 ("ceph: reconnect to the export targets on new mdsmaps")
> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
> fs/ceph/mdsmap.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> I'll plan to fold this change into the original patch since it hasn't
> been merged yet. Let me know if you have objections.
>
> diff --git a/fs/ceph/mdsmap.c b/fs/ceph/mdsmap.c
> index d995cb02d30c..61d67cbcb367 100644
> --- a/fs/ceph/mdsmap.c
> +++ b/fs/ceph/mdsmap.c
> @@ -263,8 +263,10 @@ struct ceph_mdsmap *ceph_mdsmap_decode(void **p, void *end, bool msgr2)
> goto nomem;
> for (j = 0; j < num_export_targets; j++) {
> target = ceph_decode_32(&pexport_targets);
> - if (target >= m->possible_max_rank)
> + if (target >= m->possible_max_rank) {
> + err = -EIO;
> goto corrupt;
> + }
> info->export_targets[j] = target;
> }
> } else {
Make sense and LGTM.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-30 13:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30 12:10 [PATCH] ceph: ensure we return an error when parsing corrupt mdsmap Jeff Layton
2021-08-30 13:01 ` Xiubo Li
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).