summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZheng Da <zhengda1936@gmail.com>2010-08-08 07:15:04 +0200
committerZheng Da <zhengda1936@gmail.com>2010-08-08 07:15:04 +0200
commitfee73f4e6d236a69f40e5c49e45f5f28a991d1ac (patch)
treeb19ba4047ab38c1fb3c6f0cca795a1f36c33daf8
parent82b5500bf69537c7ce5958346322320b1894e9ae (diff)
check emul_device_t object in all DS server RPCs.
-rw-r--r--libmachdev/ds_routines.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/libmachdev/ds_routines.c b/libmachdev/ds_routines.c
index 71457e03..93ac7ecc 100644
--- a/libmachdev/ds_routines.c
+++ b/libmachdev/ds_routines.c
@@ -226,6 +226,8 @@ ds_device_write (device_t dev, mach_port_t reply_port,
return D_INVALID_SIZE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->write)
{
@@ -259,6 +261,8 @@ ds_device_write_inband (device_t dev, mach_port_t reply_port,
return D_INVALID_SIZE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->write_inband)
{
@@ -288,6 +292,8 @@ ds_device_read (device_t dev, mach_port_t reply_port,
return D_NO_SUCH_DEVICE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->read)
{
@@ -316,6 +322,8 @@ ds_device_read_inband (device_t dev, mach_port_t reply_port,
return D_NO_SUCH_DEVICE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->read_inband)
{
@@ -342,6 +350,8 @@ ds_device_set_status (device_t dev, dev_flavor_t flavor,
return D_NO_SUCH_DEVICE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->set_status)
{
@@ -367,6 +377,8 @@ ds_device_get_status (device_t dev, dev_flavor_t flavor, dev_status_t status,
return D_NO_SUCH_DEVICE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->get_status)
{
@@ -392,6 +404,8 @@ ds_device_set_filter (device_t dev, mach_port_t receive_port, int priority,
return D_NO_SUCH_DEVICE;
device = mach_convert_port_to_device (dev);
+ if (device == NULL)
+ return D_INVALID_OPERATION;
if (! device->emul_ops->set_filter)
{