From: =?utf-8?q?Kristian_H=C3=B8gsberg?= Subject: firewire: Only set client->iso_context if allocation was successful. Date: Wed, 20 Jun 2007 17:48:07 -0400 This patch fixes an OOPS on cdev release for an fd where iso context creation failed. Signed-off-by: Kristian Høgsberg Signed-off-by: Stefan Richter --- drivers/firewire/fw-cdev.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) Index: linux/drivers/firewire/fw-cdev.c =================================================================== --- linux.orig/drivers/firewire/fw-cdev.c +++ linux/drivers/firewire/fw-cdev.c @@ -640,6 +640,7 @@ iso_callback(struct fw_iso_context *cont static int ioctl_create_iso_context(struct client *client, void *buffer) { struct fw_cdev_create_iso_context *request = buffer; + struct fw_iso_context *context; if (request->channel > 63) return -EINVAL; @@ -661,15 +662,17 @@ static int ioctl_create_iso_context(stru return -EINVAL; } + context = fw_iso_context_create(client->device->card, + request->type, + request->channel, + request->speed, + request->header_size, + iso_callback, client); + if (IS_ERR(context)) + return PTR_ERR(context); + client->iso_closure = request->closure; - client->iso_context = fw_iso_context_create(client->device->card, - request->type, - request->channel, - request->speed, - request->header_size, - iso_callback, client); - if (IS_ERR(client->iso_context)) - return PTR_ERR(client->iso_context); + client->iso_context = context; /* We only support one context at this time. */ request->handle = 0;