]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is
authorkib <kib@FreeBSD.org>
Thu, 1 Dec 2011 11:36:41 +0000 (11:36 +0000)
committerkib <kib@FreeBSD.org>
Thu, 1 Dec 2011 11:36:41 +0000 (11:36 +0000)
commit132ad7aa9b624e01c572592aeb815bac0f8a5940
tree1c3c82f0514234b775b1708b1983e80b04aebcd3
parent4dbebd9e51232cf237c712f624cf1cc76206213a
If alloc_unr() call in the pipe_create() failed, then pipe->pipe_ino is
-1. But, because ino_t is unsigned, this case was not covered by the
test ino > 0 in pipeclose(), leading to the free_unr(-1). Fix it by
explicitely comparing with 0 and -1. [1]

Do no access freed memory, the inode number was cached to prevent access
to cpipe after it possibly was freed, but I failed to commit the right
patch.

Noted by: gianni [1]
Pointy hat to: kib
MFC after: 3 days
sys/kern/sys_pipe.c