Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151283611
D52038.id160641.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
D52038.id160641.diff
View Options
diff --git a/sys/compat/linsysfs/linsysfs.c b/sys/compat/linsysfs/linsysfs.c
--- a/sys/compat/linsysfs/linsysfs.c
+++ b/sys/compat/linsysfs/linsysfs.c
@@ -267,6 +267,8 @@
struct pci_devinfo *dinfo;
char *device, *host, *new_path, *devname;
+ children = NULL;
+ device = host = NULL;
new_path = path;
devname = malloc(16, M_TEMP, M_WAITOK);
@@ -294,6 +296,10 @@
strcat(new_path, device);
dir = pfs_create_dir(dir, device,
NULL, NULL, NULL, 0);
+ if (dir == NULL) {
+ error = EEXIST;
+ goto out;
+ }
cur_file = pfs_create_file(dir, "vendor",
&linsysfs_fill_vendor, NULL, NULL, NULL,
PFS_RD);
@@ -338,10 +344,10 @@
NULL, NULL, NULL, 0);
scsi_host = malloc(sizeof(
struct scsi_host_queue),
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_WAITOK);
scsi_host->path = malloc(
strlen(new_path) + 1,
- M_DEVBUF, M_NOWAIT);
+ M_DEVBUF, M_WAITOK);
scsi_host->path[0] = '\000';
bcopy(new_path, scsi_host->path,
strlen(new_path) + 1);
@@ -360,8 +366,6 @@
TAILQ_INSERT_TAIL(&scsi_host_q,
scsi_host, scsi_host_next);
}
- free(device, M_TEMP);
- free(host, M_TEMP);
}
}
@@ -400,18 +404,22 @@
}
error = device_get_children(dev, &children, &nchildren);
- if (error == 0) {
- for (i = 0; i < nchildren; i++)
- if (children[i])
- linsysfs_run_bus(children[i], dir, scsi,
- chardev, drm, new_path, prefix);
- free(children, M_TEMP);
+ for (i = 0; error == 0 && i < nchildren; i++) {
+ if (children[i])
+ error = linsysfs_run_bus(children[i], dir, scsi,
+ chardev, drm, new_path, prefix);
}
+
+out:
+ free(host, M_TEMP);
+ free(device, M_TEMP);
+ if (children != NULL)
+ free(children, M_TEMP);
if (new_path != path)
free(new_path, M_TEMP);
free(devname, M_TEMP);
- return (1);
+ return (error);
}
/*
@@ -479,6 +487,7 @@
struct pfs_node *kernel;
devclass_t devclass;
device_t dev;
+ int error;
TAILQ_INIT(&scsi_host_q);
@@ -510,7 +519,10 @@
}
dev = devclass_get_device(devclass, 0);
- linsysfs_run_bus(dev, pci, scsi, chardev, drm, "/pci0000:00", "0000");
+ error = linsysfs_run_bus(dev, pci, scsi, chardev, drm, "/pci0000:00",
+ "0000");
+ if (error != 0)
+ return (error);
/* /sys/devices/system */
sys = pfs_create_dir(dir, "system", NULL, NULL, NULL, 0);
diff --git a/sys/fs/pseudofs/pseudofs.c b/sys/fs/pseudofs/pseudofs.c
--- a/sys/fs/pseudofs/pseudofs.c
+++ b/sys/fs/pseudofs/pseudofs.c
@@ -133,7 +133,7 @@
for (iter = parent->pn_nodes; iter != NULL; iter = iter->pn_next) {
if (strcmp(pn->pn_name, iter->pn_name) != 0)
continue;
- printf("pfs_add_node: homonymous siblings: '%s/%s' type %d",
+ printf("pfs_add_node: homonymous siblings: '%s/%s' type %d\n",
parent->pn_name, pn->pn_name, pn->pn_type);
/* Do not detach, because we are not yet attached. */
pn->pn_parent = NULL;
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Apr 8, 7:54 AM (12 h, 42 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31086978
Default Alt Text
D52038.id160641.diff (2 KB)
Attached To
Mode
D52038: linsysfs: error check device-directory creation
Attached
Detach File
Event Timeline
Log In to Comment