netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] 9p: trans_fd, initialize recv fcall properly if not set
@ 2015-09-03  9:38 Dominique Martinet
  2015-09-06  3:15 ` Eric Van Hensbergen
  0 siblings, 1 reply; 5+ messages in thread
From: Dominique Martinet @ 2015-09-03  9:38 UTC (permalink / raw)
  To: v9fs-developer
  Cc: Eric Van Hensbergen, Ron Minnich, Latchesar Ionkov, linux-kernel,
	netdev, Dominique Martinet

That code really should never be called (rc is allocated in
tag_alloc), but if it had been it couldn't have worked...

Signed-off-by: Dominique Martinet <dominique.martinet@cea.fr>
---
 net/9p/trans_fd.c | 3 +++
 1 file changed, 3 insertions(+)

To be honest, I think it might be better to just bail out if we get in
this switch (m->req->rc == NULL after p9_tag_lookup) and not try to
allocate more, because if we get there it's likely a race condition and
silently re-allocating will end up in more troubles than trying to
recover is worth.
Thoughts ?

diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index a270dcc..0d9831a 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -363,6 +363,9 @@ static void p9_read_work(struct work_struct *work)
 				err = -ENOMEM;
 				goto error;
 			}
+			m->req->rc.capacity = m->client->msize;
+			m->req->rc.sdata = (char*)m->req->rc +
+						sizeof(struct p9_fcall);
 		}
 		m->rc.sdata = (char *)m->req->rc + sizeof(struct p9_fcall);
 		memcpy(m->rc.sdata, m->tmp_buf, m->rc.capacity);
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-09-07 15:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-03  9:38 [PATCH] 9p: trans_fd, initialize recv fcall properly if not set Dominique Martinet
2015-09-06  3:15 ` Eric Van Hensbergen
2015-09-06  6:55   ` [V9fs-developer] " Dominique Martinet
2015-09-07 14:09     ` Eric Van Hensbergen
2015-09-07 15:06   ` [PATCH v2] 9p: trans_fd, bail out if recv fcall if missing Dominique Martinet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).