esas2r: fix an error path in esas2r_ioctl_handler
authorTomas Henzl <thenzl@redhat.com>
Sun, 16 Nov 2014 13:35:33 +0000 (14:35 +0100)
committerChristoph Hellwig <hch@lst.de>
Tue, 25 Nov 2014 14:42:52 +0000 (15:42 +0100)
Is seems strange to manipulate nvram_semaphore when in this place,
this patch fixes it.

Signed-off-by: Tomas Henzl <thenzl@redhat.com>
Acked-by: Bradley Grove <bgrove@attotech.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/scsi/esas2r/esas2r_ioctl.c

index 9ac82075546a2ddb9ca0598272389e916842f4d6..c88b9f9491b5e1c949f7d59fb2a540837f713df7 100644 (file)
@@ -1420,9 +1420,10 @@ int esas2r_ioctl_handler(void *hostdata, int cmd, void __user *arg)
 
                rq = esas2r_alloc_request(a);
                if (rq == NULL) {
-                       up(&a->nvram_semaphore);
-                       ioctl->data.prw.code = 0;
-                       break;
+                       kfree(ioctl);
+                       esas2r_log(ESAS2R_LOG_WARN,
+                          "could not allocate an internal request");
+                       return -ENOMEM;
                }
 
                code = esas2r_write_params(a, rq,