From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933583Ab2HWMMh (ORCPT ); Thu, 23 Aug 2012 08:12:37 -0400 Received: from fieldses.org ([174.143.236.118]:41068 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932925Ab2HWMMd (ORCPT ); Thu, 23 Aug 2012 08:12:33 -0400 Date: Thu, 23 Aug 2012 08:12:30 -0400 From: "J. Bruce Fields" To: Cyrill Gorcunov Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Al Viro , Alexey Dobriyan , Andrew Morton , Pavel Emelyanov , James Bottomley , Matthew Helsley , aneesh.kumar@linux.vnet.ibm.com Subject: Re: [patch 4/9] fs, exportfs: Fix nil dereference if no s_export_op present Message-ID: <20120823121230.GC29943@fieldses.org> References: <20120823104323.040550004@openvz.org> <20120823104725.830795272@openvz.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120823104725.830795272@openvz.org> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 23, 2012 at 02:43:27PM +0400, Cyrill Gorcunov wrote: > If there is no s_export_op present in a target superblock > we might have nil dereference. Is that NULL dereference possible with current code, or is it a check you're adding to account for a new caller that you're about to add? I believe it's the latter, but this would be a good thing to make clear in the changelog. --b. > Fix it with eplicit test > if s_export_op is provided. > > Signed-off-by: Cyrill Gorcunov > CC: Pavel Emelyanov > CC: Al Viro > CC: Alexey Dobriyan > CC: Andrew Morton > CC: James Bottomley > CC: "Aneesh Kumar K.V" > CC: Alexey Dobriyan > CC: Matthew Helsley > CC: "J. Bruce Fields" > CC: "Aneesh Kumar K.V" > --- > fs/exportfs/expfs.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > Index: linux-2.6.git/fs/exportfs/expfs.c > =================================================================== > --- linux-2.6.git.orig/fs/exportfs/expfs.c > +++ linux-2.6.git/fs/exportfs/expfs.c > @@ -357,7 +357,7 @@ int exportfs_encode_fh(struct dentry *de > */ > parent = p->d_inode; > } > - if (nop->encode_fh) > + if (nop && nop->encode_fh) > error = nop->encode_fh(inode, fid->raw, max_len, parent); > else > error = export_encode_fh(inode, fid, max_len, parent); >