Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp985909imm; Wed, 8 Aug 2018 08:53:34 -0700 (PDT) X-Google-Smtp-Source: AA+uWPxJzsoRAitiJ2xS9NPoB09vrBKaYzPp4CfjV8ihjnddOQTZ3hBaGmudBkIEsf0ruVE8XNwi X-Received: by 2002:a62:1647:: with SMTP id 68-v6mr3562247pfw.6.1533743614327; Wed, 08 Aug 2018 08:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533743614; cv=none; d=google.com; s=arc-20160816; b=jSdMAjeDQNkqAoQLNXA4/GkzaYE4Rza4eXuCOonEqYDOEGU5SF81tBdu1aGWVrIlV8 Dws2nQIbyOXdn942xI07pBhHIUZIv+n8Qk9Nif7kBacxLWh2lsqinaTZHctT2ws9tvUw 5CDgk5KByrcK82E6szFKGalzoeKpDo5GY/pgIVk6a1X/nrAfPRjB3ebH+Ge9UYjtXyF4 hKP//k6j3zVbM69qm63QG/kCmT82SO00eQydGKhwHCniuuIBNDMk7CLkaGPcFDknw3h6 Jtk+YIMlfcuyhguNFFup3/pAySAV5ca1b3uzUysm4VeO5LOYFl4FSSA3CbGvjYyd8mU0 zK8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=jSjyTX8iBANBmotfzyKb0EnTyza540f7m4hbaCig8QA=; b=bKZKzRMGImjXm+bvl9FTEjctYCmtvAIw74aBf1knv+0RpTNCVxK4zeXCp3tQKvnio1 lrTUmisVZNcn4ObwaVyUgts/e7FaUpUfppu/ux2oTgUfrwVAMliZ6iqG/KTGMyDaZ7DR FhhF03n9SaBSFgAjQdpeeEG33F2Bnq9P+hPLw7hHYjckx/G+AL6ULtmpMQpZfdtvfLBG rggrG4kztHYhnH+Yj6rIFJEPfCcGdnOblwOTatOPJeSF6plPvOJwMQMil0oOieLPy0T9 cn9PRcDe/N1XMl6YRGzhMIOk/AWB0ex8Xz3B168c6ij8uMfg5pzwGII1IxbvoYONV8zJ rn1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ia/YK4bD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y8-v6si5125794pfk.75.2018.08.08.08.53.19; Wed, 08 Aug 2018 08:53:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b="Ia/YK4bD"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727584AbeHHSMM (ORCPT + 99 others); Wed, 8 Aug 2018 14:12:12 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33051 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727177AbeHHSML (ORCPT ); Wed, 8 Aug 2018 14:12:11 -0400 Received: by mail-pl0-f68.google.com with SMTP id b90-v6so1226946plb.0 for ; Wed, 08 Aug 2018 08:51:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=jSjyTX8iBANBmotfzyKb0EnTyza540f7m4hbaCig8QA=; b=Ia/YK4bDrXaZYV+9agbJ6qHrEfulTCJJtEuYslr+wRKmIDB9nf7qNn5/lSECjXLa3s nmuJvDNdjXVzTTtMBiMVxkPega+0sI7q/kNks/pJBYHIpTEoEsZgoeaP2Q41716/924y lROjT8ItaZBYBPLAM7EN1As59XvxLZKEARXcEGk61qTKX+kqY7sXo52BrH7KN40S+/PR GcSLyqRK2zKNHb0++AsFLfYcJRXhKwZe+5cEyWTZ1MBAppd2fsOl3vtrv2V6kKuECATs 5A8fYtSyCS95fSmFvjcusWt18i2oxvB4hYo6EcrbkCd+/nZbOSM5rXroW/SD1zcGea4Y 6DFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=jSjyTX8iBANBmotfzyKb0EnTyza540f7m4hbaCig8QA=; b=NVplQ8H5/K+weXPNWoXpecrzj4iVmm/pP3UzbGZjwnlPFq8J2jAYajfJ64E4jNs0OU 0zI0M+N5hbgpdanIM3SaA1QJHVZOZl3sX0E/U/ahUB0C9Z1pC78HGkX/1qh4EYljPctu TDbpKLjQEn4XziXUoHzcQg8bj4gUzmXIMNMqEhaPtmlEZIyik/+SU4xYTsXQOM84uPtl YhmAGI7NxCJvoWZ6cUJgU9kASsOde+bkoP0Gd5eZKCIPbCqGLgPcDmI7ObaqC6tpZJai xGMnt9XaQV0A2IsHgGBb8Q77jMWGrMGsAyNySyY3kvQhHuihioJwmetZs/Y6/Zl9PG2f Jf8A== X-Gm-Message-State: AOUpUlFkCIQ8C83hmiv0IwoeJGqgzaImXesrmUcxUPnt450204dEEE5b o8iMhj53xA37vpxCij0J2kypKy6usFKLUSk7EdM5wg== X-Received: by 2002:a17:902:740b:: with SMTP id g11-v6mr3122696pll.85.1533743514551; Wed, 08 Aug 2018 08:51:54 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a17:90a:ac14:0:0:0:0 with HTTP; Wed, 8 Aug 2018 08:51:34 -0700 (PDT) In-Reply-To: <20180726221527.GA9426@nautica> References: <20180726081049.10527-1-tomasbortoli@gmail.com> <20180726081727.GA6699@nautica> <20180726094849.GA18334@nautica> <20180726142109.GA4235@nautica> <20180726221527.GA9426@nautica> From: Dmitry Vyukov Date: Wed, 8 Aug 2018 17:51:34 +0200 Message-ID: Subject: Re: [PATCH] 9p: fix NULL pointer dereferences To: Dominique Martinet Cc: Tomas Bortoli , David Miller , v9fs-developer@lists.sourceforge.net, netdev , LKML , syzkaller Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 27, 2018 at 12:15 AM, Dominique Martinet wrote: > Tomas Bortoli wrote on Thu, Jul 26, 2018: >> > If we want to preserve the current behaviour for trans=fd (and I don't >> > see why not) we just have to patch all the transports that use the >> > device, that is all .create functions but p9_fd_create() >> > >> > Basically exactly what you did, just for a few more functions - I >> > apparently was a little bit too optimistic thinking we could share >> > this check. >> >> Does v9fs_mount() knows the transport ahead? Because in that case it'd >> be possible to check if addr!=NULL && trans!=fd then return error >> >> Otherwise, patching all the .create, ok. > > 9p option parsing is all over the place, split in fs/9p/v9fs, > net/9p/client and net/9p/trans_*... Which is actually somewhat of a > problem because that means we can't warn on unused option as each parser > does not know the full subset of options used, so if someone makes a > typo they're on their own to figure it out :/ > > > If you want to factor it in, v9fs_mount does not know which transport is > used, but p9_client_create does know - although the functions/structs > are all static so you need to check clnt->trans_mod->name with strcmp > and I'm honestly not sure that's better than checking in each function.. > > But, as usual I'm happy as long as it works, so pick your poison :) So let's proceed with checking in each transport function?