aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dlm/lock.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-01-25 00:58:46 -0500
committerDavid Teigland <teigland@redhat.com>2008-02-04 02:22:42 -0500
commiteef7d739c218cb2546cf95686db77de0d76e4122 (patch)
tree4d6c0e65e8aff1afb2c6428c729a98274ccb1a6d /fs/dlm/lock.c
parent8b0d8e03f847d9c1677b8a193cd124debbc54633 (diff)
dlm: dlm_process_incoming_buffer() fixes
* check that length is large enough to cover the non-variable part of message or rcom resp. (after checking that it's large enough to cover the header, of course). * kill more pointless casts Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David Teigland <teigland@redhat.com>
Diffstat (limited to 'fs/dlm/lock.c')
-rw-r--r--fs/dlm/lock.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index d9f07a42e3cf..2a28048252ed 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -3822,21 +3822,20 @@ void dlm_receive_message_saved(struct dlm_ls *ls, struct dlm_message *ms)
3822 standard locking activity) or an RCOM (recovery message sent as part of 3822 standard locking activity) or an RCOM (recovery message sent as part of
3823 lockspace recovery). */ 3823 lockspace recovery). */
3824 3824
3825void dlm_receive_buffer(struct dlm_header *hd, int nodeid) 3825void dlm_receive_buffer(union dlm_packet *p, int nodeid)
3826{ 3826{
3827 struct dlm_message *ms = (struct dlm_message *) hd; 3827 struct dlm_header *hd = &p->header;
3828 struct dlm_rcom *rc = (struct dlm_rcom *) hd;
3829 struct dlm_ls *ls; 3828 struct dlm_ls *ls;
3830 int type = 0; 3829 int type = 0;
3831 3830
3832 switch (hd->h_cmd) { 3831 switch (hd->h_cmd) {
3833 case DLM_MSG: 3832 case DLM_MSG:
3834 dlm_message_in(ms); 3833 dlm_message_in(&p->message);
3835 type = ms->m_type; 3834 type = p->message.m_type;
3836 break; 3835 break;
3837 case DLM_RCOM: 3836 case DLM_RCOM:
3838 dlm_rcom_in(rc); 3837 dlm_rcom_in(&p->rcom);
3839 type = rc->rc_type; 3838 type = p->rcom.rc_type;
3840 break; 3839 break;
3841 default: 3840 default:
3842 log_print("invalid h_cmd %d from %u", hd->h_cmd, nodeid); 3841 log_print("invalid h_cmd %d from %u", hd->h_cmd, nodeid);
@@ -3856,7 +3855,7 @@ void dlm_receive_buffer(struct dlm_header *hd, int nodeid)
3856 hd->h_lockspace, nodeid, hd->h_cmd, type); 3855 hd->h_lockspace, nodeid, hd->h_cmd, type);
3857 3856
3858 if (hd->h_cmd == DLM_RCOM && type == DLM_RCOM_STATUS) 3857 if (hd->h_cmd == DLM_RCOM && type == DLM_RCOM_STATUS)
3859 dlm_send_ls_not_ready(nodeid, rc); 3858 dlm_send_ls_not_ready(nodeid, &p->rcom);
3860 return; 3859 return;
3861 } 3860 }
3862 3861
@@ -3865,9 +3864,9 @@ void dlm_receive_buffer(struct dlm_header *hd, int nodeid)
3865 3864
3866 down_read(&ls->ls_recv_active); 3865 down_read(&ls->ls_recv_active);
3867 if (hd->h_cmd == DLM_MSG) 3866 if (hd->h_cmd == DLM_MSG)
3868 dlm_receive_message(ls, ms, nodeid); 3867 dlm_receive_message(ls, &p->message, nodeid);
3869 else 3868 else
3870 dlm_receive_rcom(ls, rc, nodeid); 3869 dlm_receive_rcom(ls, &p->rcom, nodeid);
3871 up_read(&ls->ls_recv_active); 3870 up_read(&ls->ls_recv_active);
3872 3871
3873 dlm_put_lockspace(ls); 3872 dlm_put_lockspace(ls);