aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/rcom.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-01-25 03:03:59 -0500
committerDavid Teigland <teigland@redhat.com>2008-02-04 02:24:20 -0500
commit02ed16b64dc5b7a4f78476bdb64da9bbf88d84b3 (patch)
tree08d4b7c195c86123db814458802cc8b2d7106ef9 /fs/dlm/rcom.c
parent4007685c6e6b5c92a07f27cd754bcca394168af2 (diff)
dlm: missing length check in check_config()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/rcom.c')
-rw-r--r--fs/dlm/rcom.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
index 3f9b96fd26e8..a312f1d97f8b 100644
--- a/fs/dlm/rcom.c
+++ b/fs/dlm/rcom.c
@@ -85,6 +85,7 @@ static void make_config(struct dlm_ls *ls, struct rcom_config *rf)
85static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid) 85static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
86{ 86{
87 struct rcom_config *rf = (struct rcom_config *) rc->rc_buf; 87 struct rcom_config *rf = (struct rcom_config *) rc->rc_buf;
88 size_t conf_size = sizeof(struct dlm_rcom) + sizeof(struct rcom_config);
88 89
89 if ((rc->rc_header.h_version & 0xFFFF0000) != DLM_HEADER_MAJOR) { 90 if ((rc->rc_header.h_version & 0xFFFF0000) != DLM_HEADER_MAJOR) {
90 log_error(ls, "version mismatch: %x nodeid %d: %x", 91 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)
93 return -EPROTO; 94 return -EPROTO;
94 } 95 }
95 96
97 if (rc->rc_header.h_length < conf_size) {
98 log_error(ls, "config too short: %d nodeid %d",
99 rc->rc_header.h_length, nodeid);
100 return -EPROTO;
101 }
102
96 if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen || 103 if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen ||
97 le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) { 104 le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) {
98 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x", 105 log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",