Fix bogus check. It was possible to panic the kernel by giving 0 length.

This is actually a local DoS, as every user can use /dev/crypto if there
is crypto hardware in the system and cryptodev.ko is loaded (or compiled
into the kernel).

Reported by:	Mike Tancsa <mike@sentex.net>
MFC after:	1 day
This commit is contained in:
Pawel Jakub Dawidek 2005-08-18 11:58:03 +00:00
parent 7df76a1312
commit e6d944d7c3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=149228

View File

@ -336,8 +336,10 @@ cryptodev_op(
if (cop->len > 256*1024-4)
return (E2BIG);
if (cse->txform && (cop->len % cse->txform->blocksize) != 0)
return (EINVAL);
if (cse->txform) {
if (cop->len == 0 || (cop->len % cse->txform->blocksize) != 0)
return (EINVAL);
}
cse->uio.uio_iov = &cse->iovec;
cse->uio.uio_iovcnt = 1;