diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-04-19 15:01:35 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 16:38:38 -0400 |
commit | fcb136e1ac5774909e0d85189f721b8dfa800e0f (patch) | |
tree | ac89a706d67783063d4f752c3acddc04c5ab10e8 /drivers/misc/mei/interrupt.c | |
parent | 6e0f180fd8b47fa0884177a142e41a86117edc23 (diff) |
mei: fix reading large reposnes
While writting to device is limitted to max_msg_length advertized
in client properites the read can be much longer delivered consequiting chunks.
We use krealloc to enlarge the buffer when needed.
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/misc/mei/interrupt.c')
-rw-r--r-- | drivers/misc/mei/interrupt.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/drivers/misc/mei/interrupt.c b/drivers/misc/mei/interrupt.c index 9bf64c06fa39..74730713a8d3 100644 --- a/drivers/misc/mei/interrupt.c +++ b/drivers/misc/mei/interrupt.c | |||
@@ -145,9 +145,21 @@ static int mei_cl_irq_read_msg(struct mei_device *dev, | |||
145 | } | 145 | } |
146 | 146 | ||
147 | if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) { | 147 | if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) { |
148 | dev_warn(&dev->pdev->dev, "message overflow.\n"); | 148 | dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n", |
149 | list_del(&cb->list); | 149 | cb->response_buffer.size, |
150 | return -ENOMEM; | 150 | mei_hdr->length, cb->buf_idx); |
151 | cb->response_buffer.data = | ||
152 | krealloc(cb->response_buffer.data, | ||
153 | mei_hdr->length + cb->buf_idx, | ||
154 | GFP_KERNEL); | ||
155 | |||
156 | if (!cb->response_buffer.data) { | ||
157 | dev_err(&dev->pdev->dev, "allocation failed.\n"); | ||
158 | list_del(&cb->list); | ||
159 | return -ENOMEM; | ||
160 | } | ||
161 | cb->response_buffer.size = | ||
162 | mei_hdr->length + cb->buf_idx; | ||
151 | } | 163 | } |
152 | 164 | ||
153 | buffer = cb->response_buffer.data + cb->buf_idx; | 165 | buffer = cb->response_buffer.data + cb->buf_idx; |