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>
This commit is contained in:
parent
4007685c6e
commit
02ed16b64d
|
@ -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)
|
static int check_config(struct dlm_ls *ls, struct dlm_rcom *rc, int nodeid)
|
||||||
{
|
{
|
||||||
struct rcom_config *rf = (struct rcom_config *) rc->rc_buf;
|
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) {
|
if ((rc->rc_header.h_version & 0xFFFF0000) != DLM_HEADER_MAJOR) {
|
||||||
log_error(ls, "version mismatch: %x nodeid %d: %x",
|
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;
|
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 ||
|
if (le32_to_cpu(rf->rf_lvblen) != ls->ls_lvblen ||
|
||||||
le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) {
|
le32_to_cpu(rf->rf_lsflags) != ls->ls_exflags) {
|
||||||
log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",
|
log_error(ls, "config mismatch: %d,%x nodeid %d: %d,%x",
|
||||||
|
|
Loading…
Reference in New Issue