From patchwork Mon Jul 27 15:59:18 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Kulkarni X-Patchwork-Id: 37584 Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6RGX0HW007155 for ; Mon, 27 Jul 2009 16:33:00 GMT Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MVT7y-0003Vw-Ed; Mon, 27 Jul 2009 16:32:42 +0000 Received: from sfi-mx-1.v28.ch3.sourceforge.com ([172.29.28.121] helo=mx.sourceforge.net) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MVT7w-0003Vi-MY for v9fs-developer@lists.sourceforge.net; Mon, 27 Jul 2009 16:32:40 +0000 X-ACL-Warn: Received: from mail-bw0-f215.google.com ([209.85.218.215]) by 29vjzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1MVT7r-0000Ck-L9 for v9fs-developer@lists.sourceforge.net; Mon, 27 Jul 2009 16:32:40 +0000 Received: by bwz11 with SMTP id 11so2804640bwz.10 for ; Mon, 27 Jul 2009 09:32:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.126.66 with SMTP id b2mr2792911fas.18.1248710358087; Mon, 27 Jul 2009 08:59:18 -0700 (PDT) In-Reply-To: <1248707662-4060-1-git-send-email-adkulkar@umail.iu.edu> References: <1248707662-4060-1-git-send-email-adkulkar@umail.iu.edu> Date: Mon, 27 Jul 2009 09:59:18 -0600 Message-ID: From: Abhishek Kulkarni To: linux-kernel@vger.kernel.org X-Spam-Score: -0.6 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.6 AWL AWL: From: address is in the auto white-list X-Headers-End: 1MVT7r-0000Ck-L9 Cc: v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org Subject: Re: [V9fs-developer] [PATCH] net/9p: Insulate the client against an invalid error code sent by a 9p server. 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 Adding netdev to Cc. --- A looney tunes server sending an invalid error code (which is !IS_ERR_VALUE) can result in a client oops. So fix it by adding a check and converting unknown or invalid error codes to -ESERVERFAULT. Signed-off-by: Abhishek Kulkarni --- :100644 100644 787ccdd... c9a5bf9... M net/9p/client.c :100644 100644 fdebe43... 5251851... M net/9p/error.c net/9p/client.c | 7 +------ net/9p/error.c | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/net/9p/client.c b/net/9p/client.c index 787ccdd..c9a5bf9 100644 --- a/net/9p/client.c +++ b/net/9p/client.c @@ -411,14 +411,9 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req) if (c->dotu) err = -ecode; - if (!err) { + if (!err || !IS_ERR_VALUE(err)) err = p9_errstr2errno(ename, strlen(ename)); - /* string match failed */ - if (!err) - err = -ESERVERFAULT; - } - P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename); kfree(ename); diff --git a/net/9p/error.c b/net/9p/error.c index fdebe43..5251851 100644 --- a/net/9p/error.c +++ b/net/9p/error.c @@ -239,7 +239,7 @@ int p9_errstr2errno(char *errstr, int len) errstr[len] = 0; printk(KERN_ERR "%s: server reported unknown error %s\n", __func__, errstr); - errno = 1; + errno = ESERVERFAULT; } return -errno;