Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F148461929
D25618.id74301.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D25618.id74301.diff
View Options
Index: sys/compat/linux/linux_stats.c
===================================================================
--- sys/compat/linux/linux_stats.c
+++ sys/compat/linux/linux_stats.c
@@ -81,11 +81,8 @@
if (rootdevmp != NULL && vp->v_mount->mnt_vfc == rootdevmp->mnt_vfc)
sb->st_dev = rootdevmp->mnt_stat.f_fsid.val[0];
- if (vp->v_type == VCHR && vp->v_rdev != NULL &&
- linux_driver_get_major_minor(devtoname(vp->v_rdev),
- &major, &minor) == 0) {
+ if (linux_vn_get_major_minor(vp, &major, &minor) == 0)
sb->st_rdev = (major << 8 | minor);
- }
}
static int
@@ -141,9 +138,7 @@
if (mp != NULL && mp->mnt_vfc == rootdevmp->mnt_vfc)
buf->st_dev = rootdevmp->mnt_stat.f_fsid.val[0];
}
- if (vp != NULL && vp->v_rdev != NULL &&
- linux_driver_get_major_minor(devtoname(vp->v_rdev),
- &major, &minor) == 0) {
+ if (linux_vn_get_major_minor(vp, &major, &minor) == 0) {
buf->st_rdev = (major << 8 | minor);
} else if (fp->f_type == DTYPE_PTS) {
struct tty *tp = fp->f_data;
Index: sys/compat/linux/linux_util.h
===================================================================
--- sys/compat/linux/linux_util.h
+++ sys/compat/linux/linux_util.h
@@ -120,6 +120,7 @@
int linux_device_unregister_handler(struct linux_device_handler *h);
char *linux_driver_get_name_dev(device_t dev);
int linux_driver_get_major_minor(const char *node, int *major, int *minor);
+int linux_vn_get_major_minor(const struct vnode *vn, int *major, int *minor);
char *linux_get_char_devices(void);
void linux_free_get_char_devices(char *string);
Index: sys/compat/linux/linux_util.c
===================================================================
--- sys/compat/linux/linux_util.c
+++ sys/compat/linux/linux_util.c
@@ -36,6 +36,7 @@
#include <sys/param.h>
#include <sys/bus.h>
+#include <sys/conf.h>
#include <sys/fcntl.h>
#include <sys/lock.h>
#include <sys/malloc.h>
@@ -193,6 +194,24 @@
}
return (1);
+}
+
+int
+linux_vn_get_major_minor(const struct vnode *vp, int *major, int *minor)
+{
+ int error;
+
+ if (vp->v_type != VCHR)
+ return (ENOTBLK);
+ dev_lock();
+ if (vp->v_rdev == NULL) {
+ dev_unlock();
+ return (ENXIO);
+ }
+ error = linux_driver_get_major_minor(devtoname(vp->v_rdev),
+ major, minor);
+ dev_unlock();
+ return (error);
}
char *
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Mar 19, 1:29 AM (9 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29937346
Default Alt Text
D25618.id74301.diff (2 KB)
Attached To
Mode
D25618: Fix potential race condition in linux stat(2)
Attached
Detach File
Event Timeline
Log In to Comment