NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

kern/56441: puffs(4) has error-check wrong way around for poll(2) ops

>Number:         56441
>Category:       kern
>Synopsis:       puffs(4) has error-check wrong way around for poll(2) ops
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Oct 05 16:25:00 +0000 2021
>Originator:     David MacKay
>Release:        9.2
NetBSD 9.2 NetBSD 9.2 (GENERIC) #0: Wed May 12 13:15:55 UTC 2021 amd64
An error check in the PUFFS code for poll() ops is the wrong way around. If there is an error returned by the PUFFS userland server, the kernel code sets revents to what the userland server delivered, if not, it sets revents to POLLERR. It should do the opposite.

This means that if your PUFFS filesystem returns 0 from its poll operation, you will unexpectedly get a POLLERR delivered to any poll()'ers, but if your PUFFS filesystem returns an error from its poll op, your poll()'ers will get the expected events.

See sys/fs/puffs/puffs_subr.c line 148 
Implement a poll() op in a PUFFS filesystem. Set revents in it and return 0. Anyone poll()ing that file will get a POLLERR event. Return an error instead, and anyone poll()ing that file will instead get the expected events as you set.
> if (error)
to instead read
> if (error == 0)

Home | Main Index | Thread Index | Old Index