From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754379AbbCBNDF (ORCPT ); Mon, 2 Mar 2015 08:03:05 -0500 Received: from h1446028.stratoserver.net ([85.214.92.142]:48010 "EHLO mail.ahsoftware.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751462AbbCBNDD (ORCPT ); Mon, 2 Mar 2015 08:03:03 -0500 Message-ID: <54F45F80.3000604@ahsoftware.de> Date: Mon, 02 Mar 2015 14:02:56 +0100 From: Alexander Holler User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Al Viro , Richard Weinberger CC: USB list , LKML Subject: Re: gadgetfs broken since 7f7f25e8 References: <54F41F11.1020506@ahsoftware.de> <20150302102032.GP29656@ZenIV.linux.org.uk> <54F44BDF.5080109@ahsoftware.de> In-Reply-To: <54F44BDF.5080109@ahsoftware.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 02.03.2015 um 12:39 schrieb Alexander Holler: > Am 02.03.2015 um 11:20 schrieb Al Viro: >> On Mon, Mar 02, 2015 at 10:13:27AM +0100, Richard Weinberger wrote: >>> On Mon, Mar 2, 2015 at 9:28 AM, Alexander Holler >>> wrote: >>>> Hello. >>>> >>>> Commit 7f7f25e82d54870df24d415a7007fbd327da027b (introduced with >>>> 3.16) broke >>>> dynamic changing of file_operations->[read|write]. >>>> >>>> At least gadgetfs is a victim. >>>> >>>> Feel free to ask me off-list for a patch as I don't want to end up in >>>> annoying discussions on Linux kernel lists anymore. >>>> >>>> Alexander Holler >>> >>> CC'ing Al. >> >> I know. FWIW, gadgetfs is one of the very few places that tried to >> pull that >> crap off and it had always been seriously racy. I've posted a partial >> analysis >> about a month ago (<20150204190645.GJ29656@ZenIV.linux.org.uk>). >> >> If Alexander (or anybody else) has a patch that really fixes that thing, >> I would certainly like to see it. If not, I'll try to cook something, >> but I'm not very familiar with that code. I really hope that this patch >> isn't "modify ->f_mode to match ->f_op change" - that's too racy. >> We'll obviously need to fix the userland-visible breakage in that one, >> but that's not the way to go... > > I exactly did what you've assumed, I've just fixed f_mode but not the > already existing races which I haven't introduced. So I was right in not > sending a patch as would have been blamed for not rewriting everything > as so often. Another quick solution would be to just add some dummy ops for read/write to those file_operations which are missing it which are only returning -EINVAL or some other error which might make sense. But that still won't fix any existing race occuring while changing the the ops.