From patchwork Wed Jul 29 19:49:02 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Abhishek Kulkarni X-Patchwork-Id: 38233 X-Patchwork-Delegate: ericvh@gmail.com 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 n6TKwEf4032002 for ; Wed, 29 Jul 2009 20:58:14 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 1MWGDc-00083V-9W; Wed, 29 Jul 2009 20:57:48 +0000 Received: from sfi-mx-4.v28.ch3.sourceforge.com ([172.29.28.124] helo=mx.sourceforge.net) by 335xhf1.ch3.sourceforge.com with esmtp (Exim 4.69) (envelope-from ) id 1MWGDa-00082t-Hn for v9fs-developer@lists.sourceforge.net; Wed, 29 Jul 2009 20:57:46 +0000 X-ACL-Warn: Received: from rv-out-0708.google.com ([209.85.198.244]) by 1b2kzd1.ch3.sourceforge.com with esmtp (Exim 4.69) id 1MWGDQ-00045q-Bc for v9fs-developer@lists.sourceforge.net; Wed, 29 Jul 2009 20:57:41 +0000 Received: by rv-out-0708.google.com with SMTP id b17so258758rvf.22 for ; Wed, 29 Jul 2009 13:57:30 -0700 (PDT) Received: by 10.141.29.16 with SMTP id g16mr136537rvj.214.1248896953922; Wed, 29 Jul 2009 12:49:13 -0700 (PDT) Received: from localhost.localdomain (y-130-55-115-47.lanl.gov [130.55.115.47]) by mx.google.com with ESMTPS id g14sm4027967rvb.30.2009.07.29.12.49.12 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 29 Jul 2009 12:49:13 -0700 (PDT) From: Abhishek Kulkarni To: v9fs-developer@lists.sourceforge.net Date: Wed, 29 Jul 2009 13:49:02 -0600 Message-Id: <1248896942-13027-2-git-send-email-adkulkar@umail.iu.edu> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1248896942-13027-1-git-send-email-adkulkar@umail.iu.edu> References: <1248896942-13027-1-git-send-email-adkulkar@umail.iu.edu> X-Spam-Score: -0.1 (/) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.1 AWL AWL: From: address is in the auto white-list X-Headers-End: 1MWGDQ-00045q-Bc Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [V9fs-developer] [RESEND 2/2] 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: , MIME-Version: 1.0 Errors-To: v9fs-developer-bounces@lists.sourceforge.net 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 7bbd2d5... 5bf5f22... 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 7bbd2d5..5bf5f22 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;