[Cluster-devel] [PATCH dlm/next 8/9] fs: dlm: check on dlm header size

Alexander Ahring Oder Aring aahringo at redhat.com
Fri Feb 5 20:50:42 UTC 2021


Hi,

On Thu, Feb 4, 2021 at 4:51 PM Alexander Aring <aahringo at redhat.com> wrote:
>
> This patch adds checks for the dlm header size that the parsing loop
> will not stop on messages which are dlm header only and rejects msglen
> field of the dlm header which are less than dlm header size. A msglen
> field cannot be less than the dlm header size because the field is
> inclusive header lengths.
>
> Signed-off-by: Alexander Aring <aahringo at redhat.com>
> ---
>  fs/dlm/midcomms.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
> index fde3a6afe4be..7cda8e4be6fc 100644
> --- a/fs/dlm/midcomms.c
> +++ b/fs/dlm/midcomms.c
> @@ -42,16 +42,17 @@ int dlm_process_incoming_buffer(int nodeid, unsigned char *buf, int len)
>         uint16_t msglen;
>         int ret = 0;
>
> -       while (len >= sizeof(struct dlm_header)) {
> +       while (len > sizeof(struct dlm_header)) {

I am sorry, I fixed that in 4798cbbfbd00c498339bdcf4cc2429f53eb374ec
("fs: dlm: rework receive handling") already, the correct condition is
">=".
I will send a v2 for this one. Took me some time to debug this "again"
if it's ">" then sometimes ACK messages don't get parsed and I get
hangs at connection termination because ACK messages are only
dlm_header size long.

- Alex




More information about the Cluster-devel mailing list