mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 00:14:22 +08:00
chdev_driver: Avoid NULL pointer dereference when bch->refs == 255. From Juha Niskanen
This commit is contained in:
@@ -307,7 +307,7 @@ static int bch_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
|
|||||||
FAR struct bchlib_s **bchr = (FAR struct bchlib_s **)((uintptr_t)arg);
|
FAR struct bchlib_s **bchr = (FAR struct bchlib_s **)((uintptr_t)arg);
|
||||||
|
|
||||||
bchlib_semtake(bch);
|
bchlib_semtake(bch);
|
||||||
if (!bchr && bch->refs < 255)
|
if (!bchr || bch->refs == MAX_OPENCNT)
|
||||||
{
|
{
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user