Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1227127ybt; Sat, 11 Jul 2020 03:50:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwA/m0qhEYZel2lVex3RBxsujMGDqKXya1+foaYt50u2qim8D9wzhyI2r+FjSugD/moRtae X-Received: by 2002:a17:906:1a16:: with SMTP id i22mr47338496ejf.439.1594464615004; Sat, 11 Jul 2020 03:50:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594464614; cv=none; d=google.com; s=arc-20160816; b=FQOHhF5d1il1l8V12/Rm1jnOT/4UGyuiN60Ql8qjZ7vyGcGiuqYN8dLyhPM9k0BJpW KGuti8BbBQrxMcm7iu9pE4OHFBw9M+1oyJc4FA9R+rp+/WeEjNOgPNZ7CTjT1VFFMv9N OIHIeR3RV04JFcewWXDZx6zJ85PyxsnF3F6EF4GQwcVOqNPpvac8rEEZ3TVnV1Yzv5yE 1IufLRcvfqlyaNWR/z8kvt+TqbrbAm4GDP7UzZF+Gu5y/wOXtHlD8wQlzJ5Cj3EvPK6f pt9YPt5l1hMX604m6tW/Rh+LC5usLsApdvqn+BF3S9q3lSFiq1gEz8xIEmu2XHBJyGm9 jj+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=6Zl6ddT6LukUl9P4xnmeSATFWMCuS95v/2wv4WokuuQ=; b=fxNPRvkywKV9XPqo0uor/w9QTXDpvWvECPVXTOJIztEsBKE1fX8xUCyJm/2Bn1OADu QeIgoIqWFvPf2Hu0UNtzIDFL4GTyzh7GzQNgJz8QnboJ+ufEOCX23dAJHL43Sxq3QUMv o72ehMYiKg7hCeP4dUCjOuGEn0A6U9Nuu5q0MOp4p9XHqOaz1OieSOgwl0PYoKHuVpUL cgmHllddO7KRBsL5zb2qC5UBOxQxbV5BfK+v8R0sMekkG3slVcd4R79h0fySIDbcRkaP gOu2dj7veYh6MX2jqWSQqFJ82cYyrtXjKniIelDTtYyg1kpVUhz8M8j5p5QgNJP+O97y jTsQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h16si5753252ejb.456.2020.07.11.03.49.52; Sat, 11 Jul 2020 03:50:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727050AbgGKKtl (ORCPT + 99 others); Sat, 11 Jul 2020 06:49:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726286AbgGKKtl (ORCPT ); Sat, 11 Jul 2020 06:49:41 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97957C08C5DD; Sat, 11 Jul 2020 03:49:40 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 1001) id E7A47C009; Sat, 11 Jul 2020 12:49:38 +0200 (CEST) Date: Sat, 11 Jul 2020 12:49:23 +0200 From: Dominique Martinet To: Doug Nazar Cc: Christoph Hellwig , ericvh@gmail.com, lucho@ionkov.net, v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, syzbot+e6f77e16ff68b2434a2c@syzkaller.appspotmail.com Subject: Re: [PATCH] net/9p: validate fds in p9_fd_open Message-ID: <20200711104923.GA6584@nautica> References: <20200710085722.435850-1-hch@lst.de> <5bee3e33-2400-2d85-080e-d10cd82b0d85@nazar.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <5bee3e33-2400-2d85-080e-d10cd82b0d85@nazar.ca> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Doug Nazar wrote on Fri, Jul 10, 2020: > On 2020-07-10 04:57, Christoph Hellwig wrote: > > >diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c > >index 13cd683a658ab6..1cd8ea0e493617 100644 > >--- a/net/9p/trans_fd.c > >+++ b/net/9p/trans_fd.c > >@@ -803,20 +803,28 @@ static int p9_fd_open(struct p9_client *client, int rfd, int wfd) > > return -ENOMEM; > > ts->rd = fget(rfd); > >+ if (!ts->rd) > >+ goto out_free_ts; > >+ if (!(ts->rd->f_mode & FMODE_READ)) > >+ goto out_put_wr; > > goto out_put_rd; > > unless I'm mistaken. Good catch, I've amended the commit so feel free to skip resending unless want to change something https://github.com/martinetd/linux/commit/28e987a0dc66744fb119e18150188fd8e3debd40 -- Dominique