Commit b49d8b5d authored by Aneesh Kumar K.V's avatar Aneesh Kumar K.V Committed by Eric Van Hensbergen

net/9p: Fix kernel crash with msize 512K

With msize equal to 512K (PAGE_SIZE * VIRTQUEUE_NUM), we hit multiple
crashes. This patch fix those.
Signed-off-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: default avatarEric Van Hensbergen <ericvh@gmail.com>
parent 45089142
...@@ -263,7 +263,6 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) ...@@ -263,7 +263,6 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
{ {
int in, out, inp, outp; int in, out, inp, outp;
struct virtio_chan *chan = client->trans; struct virtio_chan *chan = client->trans;
char *rdata = (char *)req->rc+sizeof(struct p9_fcall);
unsigned long flags; unsigned long flags;
size_t pdata_off = 0; size_t pdata_off = 0;
struct trans_rpage_info *rpinfo = NULL; struct trans_rpage_info *rpinfo = NULL;
...@@ -346,7 +345,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) ...@@ -346,7 +345,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
* Arrange in such a way that server places header in the * Arrange in such a way that server places header in the
* alloced memory and payload onto the user buffer. * alloced memory and payload onto the user buffer.
*/ */
inp = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, 11); inp = pack_sg_list(chan->sg, out,
VIRTQUEUE_NUM, req->rc->sdata, 11);
/* /*
* Running executables in the filesystem may result in * Running executables in the filesystem may result in
* a read request with kernel buffer as opposed to user buffer. * a read request with kernel buffer as opposed to user buffer.
...@@ -366,8 +366,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req) ...@@ -366,8 +366,8 @@ p9_virtio_request(struct p9_client *client, struct p9_req_t *req)
} }
in += inp; in += inp;
} else { } else {
in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM, rdata, in = pack_sg_list(chan->sg, out, VIRTQUEUE_NUM,
req->rc->capacity); req->rc->sdata, req->rc->capacity);
} }
err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc); err = virtqueue_add_buf(chan->vq, chan->sg, out, in, req->tc);
...@@ -592,7 +592,14 @@ static struct p9_trans_module p9_virtio_trans = { ...@@ -592,7 +592,14 @@ static struct p9_trans_module p9_virtio_trans = {
.close = p9_virtio_close, .close = p9_virtio_close,
.request = p9_virtio_request, .request = p9_virtio_request,
.cancel = p9_virtio_cancel, .cancel = p9_virtio_cancel,
.maxsize = PAGE_SIZE*VIRTQUEUE_NUM,
/*
* We leave one entry for input and one entry for response
* headers. We also skip one more entry to accomodate, address
* that are not at page boundary, that can result in an extra
* page in zero copy.
*/
.maxsize = PAGE_SIZE * (VIRTQUEUE_NUM - 3),
.pref = P9_TRANS_PREF_PAYLOAD_SEP, .pref = P9_TRANS_PREF_PAYLOAD_SEP,
.def = 0, .def = 0,
.owner = THIS_MODULE, .owner = THIS_MODULE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment