All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christine Caulfield <ccaulfie@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH RFC] clvmd: verify messages before processing
Date: Wed, 31 Jul 2013 09:33:23 +0100	[thread overview]
Message-ID: <51F8CBD3.9090201@redhat.com> (raw)
In-Reply-To: <20130730194649.GA3707@redhat.com>

On 30/07/13 20:46, David Teigland wrote:
> Does this look like it would be useful?  More checks can be
> added over time, but are there any that would be obvious to
> add now?  I'm mainly trying to catch non-message data, and
> not risk rejecting any proper messages.
>

Mostly an ACK but see comment below:

> @@ -2189,10 +2286,22 @@ error:
>   void process_message(struct local_client *client, char *buf, int len,
>   		     const char *csid)
>   {
> +	char nodename[max_cluster_member_name_len];
>   	struct clvm_header *inheader;
> +	int rv;
>
>   	inheader = (struct clvm_header *) buf;
>   	ntoh_clvm(inheader);	/* Byteswap fields */
> +
> +	rv = verify_message(buf, len);
> +	if (rv < 0) {
> +		memset(nodename, 0, sizeof(nodename));
> +		clops->name_from_csid(csid, nodename);
> +		log_error("process_message from %s len %d bad verify\n", nodename, len);
> +		dump_message(buf, len);

Here you will probably have to return an error to the calling clvmd or 
you will get delays when the caller times out. If that happens then the 
'timed-out' message is less than helpful


> +		return;
> +	}
> +
>   	if (inheader->cmd == CLVMD_CMD_REPLY)
>   		process_reply(inheader, len, csid);
>   	else
>


Chrissie



  reply	other threads:[~2013-07-31  8:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-30 19:46 [PATCH RFC] clvmd: verify messages before processing David Teigland
2013-07-31  8:33 ` Christine Caulfield [this message]
2013-07-31 15:31   ` David Teigland
2013-08-01  9:13     ` Christine Caulfield

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F8CBD3.9090201@redhat.com \
    --to=ccaulfie@redhat.com \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.