From patchwork Mon Oct 8 15:07:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ivan Romanov X-Patchwork-Id: 1566151 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A4363DFF71 for ; Mon, 8 Oct 2012 15:20:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753942Ab2JHPUw (ORCPT ); Mon, 8 Oct 2012 11:20:52 -0400 Received: from mail3.ks.pochta.ru ([62.141.94.173]:49638 "EHLO mail3.ks.pochta.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753933Ab2JHPUv (ORCPT ); Mon, 8 Oct 2012 11:20:51 -0400 X-Greylist: delayed 814 seconds by postgrey-1.27 at vger.kernel.org; Mon, 08 Oct 2012 11:20:51 EDT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=qip.ru; s=dkim; h=Mime-Version:Content-Type:Date:Cc:To:From:Subject:Message-ID; bh=2zDyv4Kx3kZ7Rtv+XjzAwHr/Y2QUfyertUuzujGzFRE=; b=HikcZ+dEPj11JUTh0tNZWzeqTryKJ3j7Hv/9gqz6JrEdRRDEWEVtQImiKLOYBrxO1Oyo3/oFiRdhrAs62Oauay/HmkSIs0Nvfk2VPXB+EWHyk6RjQex7rBpjyT6ab3Jd; Received: from [213.87.241.89] (port=1468 helo=[10.66.91.201]) by mail3.ks.pochta.ru with esmtpa id 1TLEvI-0001JS-5m; Mon, 08 Oct 2012 19:07:12 +0400 Message-ID: <1349708828.1183.5.camel@lix> Subject: exportfs crash with long path From: Ivan Romanov To: steved@redhat.com Cc: linux-nfs@vger.kernel.org Date: Mon, 08 Oct 2012 21:07:08 +0600 X-Mailer: Evolution 3.4.4 (3.4.4-2.fc17) Mime-Version: 1.0 X-NoSpam-Exim-Host: 62.141.94.133 X-NoSpam-Exim-Port: 8092 X-NoSpam-Exim-Scanned: Yes X-NoSpam-Exim-Result: OK Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Hello. I opened a bug with nfs-utils on Redhat Bugzilla. And got an advice to email upstream. So I just repeat my bug text with a patch. How reproducible: always Steps to Reproduce: # mkdir -p /home/kudinae/????????????? # echo '/home/kudinae/????????????? oek-1(rw,sync,no_wdelay,no_root_squash,no_subtree_check)' > /etc/exports # exportfs -a Segmentation fault I've obtained the sources. So a crush happens on export.c:293. variable pos has negative value. I think problem into strtoint and export_hash functions. strtoint has unsigned type and always returns positive value but export_hash impicity cast it to signed int. So it is possible to get negative value. I wrote patch to fix this. Original Red Hat bug https://bugzilla.redhat.com/show_bug.cgi?id=863054 diff --git a/support/export/export.c b/support/export/export.c index 4fda30a..0257903 100644 --- a/support/export/export.c +++ b/support/export/export.c @@ -357,7 +357,7 @@ strtoint(char *str) static int export_hash(char *str) { - int num = strtoint(str); + unsigned int num = strtoint(str); return num % HASH_TABLE_SIZE; }