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>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
6e0f180fd8
commit
fcb136e1ac
@@ -624,7 +624,7 @@ int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
|
||||
*
|
||||
* returns 0 on success, <0 on failure.
|
||||
*/
|
||||
int mei_cl_read_start(struct mei_cl *cl)
|
||||
int mei_cl_read_start(struct mei_cl *cl, size_t length)
|
||||
{
|
||||
struct mei_device *dev;
|
||||
struct mei_cl_cb *cb;
|
||||
@@ -657,8 +657,9 @@ int mei_cl_read_start(struct mei_cl *cl)
|
||||
if (!cb)
|
||||
return -ENOMEM;
|
||||
|
||||
rets = mei_io_cb_alloc_resp_buf(cb,
|
||||
dev->me_clients[i].props.max_msg_length);
|
||||
/* always allocate at least client max message */
|
||||
length = max_t(size_t, length, dev->me_clients[i].props.max_msg_length);
|
||||
rets = mei_io_cb_alloc_resp_buf(cb, length);
|
||||
if (rets)
|
||||
goto err;
|
||||
|
||||
|
Reference in New Issue
Block a user