From: Dan Carpenter <dan.carpenter@oracle.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [patch] dlm: some checks can underflow
Date: Wed, 31 Jul 2013 19:31:20 +0300 [thread overview]
Message-ID: <20130731163120.GI5002@mwanda> (raw)
In-Reply-To: <20130731151156.GA12539@redhat.com>
On Wed, Jul 31, 2013 at 11:11:56AM -0400, David Teigland wrote:
> On Wed, Jul 31, 2013 at 12:02:29PM +0300, Dan Carpenter wrote:
> > This is a static checker fix. We have several places here that check
> > the upper limit without checking for negative numbers. One example of
> > this is in find_rsb().
> >
> > My static checker marks endian data as user controled so. The
> > "ms->m_header.h_length" variable is tagged as user data because it
> > starts as little endian and we convert it at the start of
> > dlm_receive_buffer(). That means that receive_extralen() returns
> > user controlled data which could be negative. The call tree here is:
> >
> > -> dlm_receive_buffer()
> > -> dlm_receive_message()
> > -> _receive_message()
> > -> receive_request()
> >
> > We get "namelen" from receive_extralen(ms);
> >
> > -> find_rsb()
> >
> > It's never perfectly clear how invasive to make a fix like this. Many
> > of the changes in the patch are not needed but I wanted to make things
> > consistent.
>
> If it's negative, I don't think it would pass the h_length validation
> in dlm_process_incoming_buffer(), but I'm not certain...
Gar, yeah. We check that:
if (p->header.h_cmd == DLM_MSG) {
if (msglen < sizeof(struct dlm_message))
break;
Which means receive_extralen() can't return negative.
We can drop this patch.
regards,
dan carpenter
prev parent reply other threads:[~2013-07-31 16:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-31 9:02 [Cluster-devel] [patch] dlm: some checks can underflow Dan Carpenter
2013-07-31 15:11 ` David Teigland
2013-07-31 16:31 ` Dan Carpenter [this message]
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=20130731163120.GI5002@mwanda \
--to=dan.carpenter@oracle.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).