Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F152502768
D34575.id103901.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D34575.id103901.diff
View Options
Index: sys/kern/kern_descrip.c
===================================================================
--- sys/kern/kern_descrip.c
+++ sys/kern/kern_descrip.c
@@ -4194,6 +4194,8 @@
if (fdp == NULL)
continue;
FILEDESC_SLOCK(fdp);
+ if (refcount_load(&fdp->fd_refcnt) == 0)
+ goto nextproc;
FILEDESC_FOREACH_FP(fdp, n, fp) {
if (refcount_load(&fdp->fd_refcnt) == 0)
break;
@@ -4210,6 +4212,7 @@
if (error)
break;
}
+nextproc:
FILEDESC_SUNLOCK(fdp);
fddrop(fdp);
if (error)
@@ -4469,6 +4472,8 @@
if (pwd != NULL)
pwd_drop(pwd);
FILEDESC_SLOCK(fdp);
+ if (refcount_load(&fdp->fd_refcnt) == 0)
+ goto skip;
FILEDESC_FOREACH_FP(fdp, i, fp) {
if (refcount_load(&fdp->fd_refcnt) == 0)
break;
@@ -4487,6 +4492,7 @@
if (error != 0)
break;
}
+skip:
FILEDESC_SUNLOCK(fdp);
fail:
if (fdp != NULL)
@@ -4633,6 +4639,8 @@
if (pwd != NULL)
pwd_drop(pwd);
FILEDESC_SLOCK(fdp);
+ if (refcount_load(&fdp->fd_refcnt) == 0)
+ goto skip;
FILEDESC_FOREACH_FP(fdp, i, fp) {
if (refcount_load(&fdp->fd_refcnt) == 0)
break;
@@ -4645,6 +4653,7 @@
if (error)
break;
}
+skip:
FILEDESC_SUNLOCK(fdp);
fddrop(fdp);
pddrop(pdp);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Apr 16, 9:09 AM (7 h, 57 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31592009
Default Alt Text
D34575.id103901.diff (1 KB)
Attached To
Mode
D34575: file: Avoid a read-after-free of fd tables in sysctl handlers
Attached
Detach File
Event Timeline
Log In to Comment