aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/aacraid/commctrl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/aacraid/commctrl.c')
-rw-r--r--drivers/scsi/aacraid/commctrl.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index b381b3718a98..5648b715fed9 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -63,7 +63,7 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
63 struct fib *fibptr; 63 struct fib *fibptr;
64 struct hw_fib * hw_fib = (struct hw_fib *)0; 64 struct hw_fib * hw_fib = (struct hw_fib *)0;
65 dma_addr_t hw_fib_pa = (dma_addr_t)0LL; 65 dma_addr_t hw_fib_pa = (dma_addr_t)0LL;
66 unsigned size; 66 unsigned int size, osize;
67 int retval; 67 int retval;
68 68
69 if (dev->in_reset) { 69 if (dev->in_reset) {
@@ -87,7 +87,8 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
87 * will not overrun the buffer when we copy the memory. Return 87 * will not overrun the buffer when we copy the memory. Return
88 * an error if we would. 88 * an error if we would.
89 */ 89 */
90 size = le16_to_cpu(kfib->header.Size) + sizeof(struct aac_fibhdr); 90 osize = size = le16_to_cpu(kfib->header.Size) +
91 sizeof(struct aac_fibhdr);
91 if (size < le16_to_cpu(kfib->header.SenderSize)) 92 if (size < le16_to_cpu(kfib->header.SenderSize))
92 size = le16_to_cpu(kfib->header.SenderSize); 93 size = le16_to_cpu(kfib->header.SenderSize);
93 if (size > dev->max_fib_size) { 94 if (size > dev->max_fib_size) {
@@ -118,6 +119,14 @@ static int ioctl_send_fib(struct aac_dev * dev, void __user *arg)
118 goto cleanup; 119 goto cleanup;
119 } 120 }
120 121
122 /* Sanity check the second copy */
123 if ((osize != le16_to_cpu(kfib->header.Size) +
124 sizeof(struct aac_fibhdr))
125 || (size < le16_to_cpu(kfib->header.SenderSize))) {
126 retval = -EINVAL;
127 goto cleanup;
128 }
129
121 if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) { 130 if (kfib->header.Command == cpu_to_le16(TakeABreakPt)) {
122 aac_adapter_interrupt(dev); 131 aac_adapter_interrupt(dev);
123 /* 132 /*