From patchwork Wed Oct 13 09:39:12 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aneesh Kumar K.V" X-Patchwork-Id: 250101 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o9D9dpYc013242 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 13 Oct 2010 09:40:14 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-1.v29.ch3.sourceforge.com) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1P5xoE-0003bX-6c; Wed, 13 Oct 2010 09:39:42 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-1.v29.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1P5xoC-0003bP-H8 for v9fs-developer@lists.sourceforge.net; Wed, 13 Oct 2010 09:39:40 +0000 X-ACL-Warn: Received: from e23smtp08.au.ibm.com ([202.81.31.141]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES256-SHA:256) (Exim 4.69) id 1P5xoB-0007VV-9G for v9fs-developer@lists.sourceforge.net; Wed, 13 Oct 2010 09:39:40 +0000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [202.81.31.247]) by e23smtp08.au.ibm.com (8.14.4/8.13.1) with ESMTP id o9D9dVZH004141 for ; Wed, 13 Oct 2010 20:39:31 +1100 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o9D9dVZH2203872 for ; Wed, 13 Oct 2010 20:39:31 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9D9dVql007964 for ; Wed, 13 Oct 2010 20:39:31 +1100 Received: from skywalker.linux.vnet.ibm.com ([9.77.204.225]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o9D9dJuM007371; Wed, 13 Oct 2010 20:39:23 +1100 From: "Aneesh Kumar K. V" To: Sanchit Garg , v9fs-developer@lists.sourceforge.net In-Reply-To: <20101012100626.1722.68762.stgit@sancgarg.in.ibm.com> References: <20101012100626.1722.68762.stgit@sancgarg.in.ibm.com> User-Agent: Notmuch/0.3.1-90-g8071c5c (http://notmuchmail.org) Emacs/23.1.50.1 (i486-pc-linux-gnu) Date: Wed, 13 Oct 2010 15:09:12 +0530 Message-ID: MIME-Version: 1.0 X-Spam-Score: -0.1 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 AWL AWL: From: address is in the auto white-list X-Headers-End: 1P5xoB-0007VV-9G Subject: Re: [V9fs-developer] [PATCH] Read/Write from bad user space buffer X-BeenThere: v9fs-developer@lists.sourceforge.net X-Mailman-Version: 2.1.9 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: v9fs-developer-bounces@lists.sourceforge.net X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 13 Oct 2010 09:40:14 +0000 (UTC) diff --git a/net/9p/client.c b/net/9p/client.c index b2b066a..40315f2 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -579,6 +579,9 @@ p9_client_rpc(struct p9_client *c, int8_t type, const char *fmt, ...) va_start(ap, fmt); err = p9pdu_vwritef(req->tc, c->proto_version, fmt, ap); va_end(ap); + if (err) + goto reterr; + p9pdu_finalize(req->tc); err = c->trans_mod->request(c, req); diff --git a/net/9p/protocol.c b/net/9p/protocol.c index 3acd3af..28b66ed 100644 --- a/net/9p/protocol.c +++ b/net/9p/protocol.c @@ -122,9 +122,9 @@ static size_t pdu_write_u(struct p9_fcall *pdu, const char __user *udata, size_t size) { size_t len = MIN(pdu->capacity - pdu->size, size); - int err = copy_from_user(&pdu->sdata[pdu->size], udata, len); - if (err) - printk(KERN_WARNING "pdu_write_u returning: %d\n", err); + if (copy_from_user(&pdu->sdata[pdu->size], udata, len)) + /* Failed to read a copy_from_user */ + len = 0; pdu->size += len; return size - len;