public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org,
	security@kernel.org, ebiederm@xmission.com,
	stable@vger.kernel.org
Subject: Re: [PATCH] crypto_user: Fix out-of-bounds read
Date: Wed, 23 Apr 2014 14:40:39 +0300	[thread overview]
Message-ID: <20140423114039.GY4963@mwanda> (raw)
In-Reply-To: <57bf4e51f05fad506a0d1638852a5233b359e1dc.1398194946.git.luto@amacapital.net>

On Tue, Apr 22, 2014 at 12:30:28PM -0700, Andy Lutomirski wrote:
> This is unlikely to be exploitable for anything except an OOPS.
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Andy Lutomirski <luto@amacapital.net>
> ---
> 
> Notes:
>     This is entirely untested, but it looks obviously correct to me.
> 
>  crypto/crypto_user.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/crypto/crypto_user.c b/crypto/crypto_user.c
> index 1512e41..bc7c4b5 100644
> --- a/crypto/crypto_user.c
> +++ b/crypto/crypto_user.c
> @@ -460,7 +460,7 @@ static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
>  	int type, err;
>  
>  	type = nlh->nlmsg_type;
> -	if (type > CRYPTO_MSG_MAX)
> +	if (type < CRYPTO_MSG_BASE || type > CRYPTO_MSG_MAX)
>  		return -EINVAL;

Adding a check here is obviously harmless but I think this is only
called from netlink_rcv_skb() which already checks:

	if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
		goto ack;

NLMSG_MIN_TYPE is 0x10 as well, so I don't think we can hit your
condition.

Your patch freaked me out a little because this is one of the bugs that
I should have caught throught static analysis.

regards,
dan carpenter


  reply	other threads:[~2014-04-23 11:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-22 19:30 [PATCH] crypto_user: Fix out-of-bounds read Andy Lutomirski
2014-04-23 11:40 ` Dan Carpenter [this message]
2014-04-23 15:48   ` Andy Lutomirski
2014-04-23 19:23     ` Dan Carpenter

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=20140423114039.GY4963@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=davem@davemloft.net \
    --cc=ebiederm@xmission.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=security@kernel.org \
    --cc=stable@vger.kernel.org \
    /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