From 9a4b29355b80e39ce846ccf20117cf0dc120828e Mon Sep 17 00:00:00 2001 From: Al Viro Date: Fri, 25 Jan 2008 03:03:59 -0500 Subject: [PATCH] --- yaml --- r: 84886 b: refs/heads/master c: 02ed16b64dc5b7a4f78476bdb64da9bbf88d84b3 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/fs/dlm/rcom.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/[refs] b/[refs] index e4a6d7a991d0..0397b4dbfad3 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 4007685c6e6b5c92a07f27cd754bcca394168af2 +refs/heads/master: 02ed16b64dc5b7a4f78476bdb64da9bbf88d84b3 diff --git a/trunk/fs/dlm/rcom.c b/trunk/fs/dlm/rcom.c index 3f9b96fd26e8..a312f1d97f8b 100644 --- a/trunk/fs/dlm/rcom.c +++ b/trunk/fs/dlm/rcom.c @@ -85,6 +85,7 @@ static void make_config(struct dlm_ls *ls, struct rcom_config *rf) static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) { struct rcom_config *rf = (struct rcom_config *) rc->rc_buf; + size_t conf_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_config); if ((rc->rc_header.h_version & 0xFFFF0000) != DLM_HEADER_MAJOR) { log_error(ls, "version mismatch: %x nodeid %d: %x", @@ -93,6 +94,12 @@ static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) return -EPROTO; } + if (rc->rc_header.h_length < conf_size) { + log_error(ls, "config too short: %d nodeid %d", + rc->rc_header.h_length, nodeid); + return -EPROTO; + } + if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen || le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) { log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",