diff options
author | Tomas Winkler <tomas.winkler@intel.com> | 2013-04-19 22:01:35 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-04-19 13:38:38 -0700 |
commit | fcb136e1ac5774909e0d85189f721b8dfa800e0f (patch) | |
tree | ac89a706d67783063d4f752c3acddc04c5ab10e8 /drivers/misc/mei/interrupt.c | |
parent | 6e0f180fd8b47fa0884177a142e41a86117edc23 (diff) | |
download | op-kernel-dev-fcb136e1ac5774909e0d85189f721b8dfa800e0f.zip op-kernel-dev-fcb136e1ac5774909e0d85189f721b8dfa800e0f.tar.gz |
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 9bf64c0..7473071 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, } if (cb->response_buffer.size < mei_hdr->length + cb->buf_idx) { - dev_warn(&dev->pdev->dev, "message overflow.\n"); - list_del(&cb->list); - return -ENOMEM; + dev_dbg(&dev->pdev->dev, "message overflow. size %d len %d idx %ld\n", + cb->response_buffer.size, + mei_hdr->length, cb->buf_idx); + cb->response_buffer.data = + krealloc(cb->response_buffer.data, + mei_hdr->length + cb->buf_idx, + GFP_KERNEL); + + if (!cb->response_buffer.data) { + dev_err(&dev->pdev->dev, "allocation failed.\n"); + list_del(&cb->list); + return -ENOMEM; + } + cb->response_buffer.size = + mei_hdr->length + cb->buf_idx; } buffer = cb->response_buffer.data + cb->buf_idx; |