[PATCH] crypto_user: Fix out-of-bounds read

Andy Lutomirski
2014-04-22T19:30:36Z

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;

type -= CRYPTO_MSG_BASE;
--
1.9.0