drivers/note: noteram ioctl FIONBIO should return -ENOTTY

In file_dup3, the file descriptor is initialized with the O_NONBLOCK flag.
If the inode's ioctl(FIONBIO) call fails with a result other than OK or
ENOTTY, the file may be mistakenly released.

Signed-off-by: zhangyuan29 <zhangyuan29@xiaomi.com>
This commit is contained in:
zhangyuan29
2025-06-25 14:27:31 +08:00
committed by Alan C. Assis
parent c5549143ad
commit 6c37217c36
+3 -2
View File
@@ -459,6 +459,7 @@ int noteram_close(FAR struct file *filep)
{
FAR struct noteram_dump_context_s *ctx = filep->f_priv;
filep->f_priv = NULL;
kmm_free(ctx);
return OK;
}
@@ -517,7 +518,7 @@ static ssize_t noteram_read(FAR struct file *filep, FAR char *buffer,
static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
{
int ret = -ENOSYS;
int ret = -ENOTTY;
FAR struct noteram_driver_s *drv = filep->f_inode->i_private;
irqstate_t flags = spin_lock_irqsave_notrace(&drv->lock);
@@ -625,7 +626,7 @@ static int noteram_ioctl(FAR struct file *filep, int cmd, unsigned long arg)
break;
default:
break;
break;
}
spin_unlock_irqrestore_notrace(&drv->lock, flags);