From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753557AbdEDMzW (ORCPT ); Thu, 4 May 2017 08:55:22 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48576 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753182AbdEDMzN (ORCPT ); Thu, 4 May 2017 08:55:13 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 37F9380C22 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dhowells@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 37F9380C22 Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <87fugl3c22.fsf@rasmusvillemoes.dk> References: <87fugl3c22.fsf@rasmusvillemoes.dk> <149382747487.30481.15428192741961545429.stgit@warthog.procyon.org.uk> <149382750838.30481.8003919639826341255.stgit@warthog.procyon.org.uk> To: Rasmus Villemoes Cc: dhowells@redhat.com, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, mszeredi@redhat.com Subject: Re: [PATCH 4/9] Implement fsopen() to prepare for a mount MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <22922.1493902510.1@warthog.procyon.org.uk> Date: Thu, 04 May 2017 13:55:10 +0100 Message-ID: <22923.1493902510@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Thu, 04 May 2017 12:55:12 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Rasmus Villemoes wrote: > OK, mc->error must be static data, so no lifetime problems. Technically, mc->error is only good as long as we hold a ref on its module. It might be better to copy the string, especially as we can then do printf-style formatting. > But is it possible for the compiler to mess this up and reload msg from > mc->error when it's about to do the user copy, so that if some other thread > has managed to change mc->error (or is the error state sticky and no further > operations allowed?) we'd copy from a string with a different length? Yeah - I need to put a READ_ONCE() in there. > Where does fs_name now get freed? vfs_fsopen doesn't seem to do it on > success? (If it did, the fallthrough from err_mc: to err_fs_name: would > be wrong.) I'll add a free right after the vfs_fsopen() call before checking the error - then I can get rid of err_fs_name. David