aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/firewire/fw-cdev.c
diff options
context:
space:
mode:
authorStefan Richter <stefanr@s5r6.in-berlin.de>2009-05-13 15:42:14 -0400
committerStefan Richter <stefanr@s5r6.in-berlin.de>2009-05-17 08:13:47 -0400
commit92368890d551794ee8d7e90477d8498bb7f82a9b (patch)
tree0c9fe72c0d770ce4ac358235fafd18803415b1ac /drivers/firewire/fw-cdev.c
parent32a0f488ce5e8a9a148491f15edc508ab5e8265b (diff)
firewire: core: improve check for local node
My recently added test for a device being local in fw-cdev.c got it slightly wrong: Comparisons of node IDs are only valid if the generation is current, which I forgot to check. Normally, serialization by card->lock takes care of this, but a device in FW_DEVICE_GONE state will necessarily have a wrong generation and invalid node_id. The "is it local?" check is made 100% correct and simpler now by means of a struct fw_device flag which is set at fw_device creation. Besides the fw-cdev site which was to be fixed, there is another site which can make use of the new flag, and an RFC-2734 driver will benefit from it too. Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>
Diffstat (limited to 'drivers/firewire/fw-cdev.c')
-rw-r--r--drivers/firewire/fw-cdev.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/drivers/firewire/fw-cdev.c b/drivers/firewire/fw-cdev.c
index 7eb6594cc3e5..8a5e6ae2552c 100644
--- a/drivers/firewire/fw-cdev.c
+++ b/drivers/firewire/fw-cdev.c
@@ -739,15 +739,11 @@ static void release_descriptor(struct client *client,
739static int ioctl_add_descriptor(struct client *client, void *buffer) 739static int ioctl_add_descriptor(struct client *client, void *buffer)
740{ 740{
741 struct fw_cdev_add_descriptor *request = buffer; 741 struct fw_cdev_add_descriptor *request = buffer;
742 struct fw_card *card = client->device->card;
743 struct descriptor_resource *r; 742 struct descriptor_resource *r;
744 int ret; 743 int ret;
745 744
746 /* Access policy: Allow this ioctl only on local nodes' device files. */ 745 /* Access policy: Allow this ioctl only on local nodes' device files. */
747 spin_lock_irq(&card->lock); 746 if (!client->device->is_local)
748 ret = client->device->node_id != card->local_node->node_id;
749 spin_unlock_irq(&card->lock);
750 if (ret)
751 return -ENOSYS; 747 return -ENOSYS;
752 748
753 if (request->length > 256) 749 if (request->length > 256)