From patchwork Wed Jun 8 06:43:00 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 860862 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p586hSWw024758 for ; Wed, 8 Jun 2011 06:43:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752429Ab1FHGn1 (ORCPT ); Wed, 8 Jun 2011 02:43:27 -0400 Received: from mail-wy0-f174.google.com ([74.125.82.174]:36972 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751484Ab1FHGn0 (ORCPT ); Wed, 8 Jun 2011 02:43:26 -0400 Received: by wya21 with SMTP id 21so115285wya.19 for ; Tue, 07 Jun 2011 23:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:mime-version :content-type:content-disposition:user-agent; bh=XEpBogXwkH52jZWx76w6ydD8Nb7EXwyVYyiXA5kIY/4=; b=Y9xnAb7TKm7TAO5ap82bSZDhHy1mqPnOKgBQZhumzlU6n19rk15OUhen4tY/WcnRg+ x4d8J8a8An9oCoXn9K72qfpEyDuBEclt+dYvlcLXbXwBRu1LFJe8Vik2HhMIitERLJSR W1L0HNkBwhIvNK0zyQpo3dtKRcBiF92AqIR8U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:mime-version:content-type :content-disposition:user-agent; b=j8ro4FJwEVtq3OgwEd5ikY84u4wUOIo7vRf+lDp9dq4tI4Wqsq3itGezBjFbSycPMk 4cD9vKZo0QATAb5zfqdRa3zfs9SAanMSr697cPAhKNjYUX2O4bHstfifpRxOQVTNxwsC sRxHGwZmn7ipmcX8vcF2T3aECeId1JFJB2tAc= Received: by 10.227.173.66 with SMTP id o2mr7232402wbz.12.1307515404884; Tue, 07 Jun 2011 23:43:24 -0700 (PDT) Received: from shale.localdomain ([212.49.88.34]) by mx.google.com with ESMTPS id ej7sm156032wbb.36.2011.06.07.23.43.20 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 07 Jun 2011 23:43:24 -0700 (PDT) Date: Wed, 8 Jun 2011 09:43:00 +0300 From: Dan Carpenter To: Trond Myklebust Cc: "open list:NFS, SUNRPC, AND..." , kernel-janitors@vger.kernel.org Subject: [patch] NFS: using freed variable in debug code Message-ID: <20110608064300.GE3846@shale.localdomain> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 08 Jun 2011 06:43:28 +0000 (UTC) "ds" gets dereferenced after a kfree in the debug output. I just moved the free down a line. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/nfs4filelayoutdev.c b/fs/nfs/nfs4filelayoutdev.c index 77c171e..c63bbce 100644 --- a/fs/nfs/nfs4filelayoutdev.c +++ b/fs/nfs/nfs4filelayoutdev.c @@ -362,11 +362,11 @@ nfs4_pnfs_ds_add(struct list_head *dsaddrs, gfp_t gfp_flags) __func__, tmp_ds->ds_remotestr, remotestr); } kfree(remotestr); - kfree(ds); atomic_inc(&tmp_ds->ds_count); dprintk("%s data server %s found, inc'ed ds_count to %d\n", __func__, ds->ds_remotestr, atomic_read(&tmp_ds->ds_count)); + kfree(ds); ds = tmp_ds; } spin_unlock(&nfs4_ds_cache_lock);