Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp784960ybh; Mon, 13 Jul 2020 00:41:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxwrkO32SeP95Zyv3Qc3JH6DAVZINAnBr9UQtdZkYSxVvR1TvdM7Psf9S5lt0G+ejuAR275 X-Received: by 2002:aa7:d7d0:: with SMTP id e16mr90531724eds.10.1594626067803; Mon, 13 Jul 2020 00:41:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594626067; cv=none; d=google.com; s=arc-20160816; b=u2sDcp9Km5d6l0APVh0sBHuvg2L5eX53Uag6c7OwywWo0fb+lfaAaLJlAGK0dt0mnH mpg7lW8SD3jSzd+Myz+aoJev3b1Xyy1zmieHKoDukF9Mw3cfWmazeAJ37PPSn3jU+1XR IZuIBBNWqyote3rZkJ6jXY3Z+RGCSbSAPsFi00v7MR8tr7PDGnTmZ1dG+HwZAIRPqErW 22vH/Agusu2dg8WDoJoMkEZKYbMCI2GYB0QzHiyP8IyCl2W4NR/XGo8pFocb0/i7U6Ng cHWjhTXVQFVL/mIPnImt8LVyT4E1y5dkZjBiP84CfnVmZnOtRrxH1LspjnywBAu0X5AR pDvg== 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=xKxrW7+0/Oa+Cdjzm4QeeOQp+Psocrt0aL2jTavsdbI=; b=bH55LuU0li+pWybiB1koGxryBm1MnRUvLEoTgOW6qCEebAbsHjYCXhL89RF2jOPnT9 f398IhluxBPHPllsKADdOC6c5nEofy3Z51Sz1NEDQpqE34eheBea3YHeavhQKmdEw7hN zK9d9qGAaa6N94ZPuBqapM7hsSNUPqb/UIjaxgSN67AeJqtdbSWHpUJDTA+E+qiklIYe WGBl9dxjKzK6kPBh94Hz4nSJSO46b6KSGj6mIaWyQENkku9576tmX+OZu5C7MozKwHgN SdFa6A6pMef91h/Xz8LM8980S3Y9ZQ51iFcyis708+UaQFXU9mclGyRhxV5JmxkZCGu9 aoqg== 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 j5si8592782ejk.74.2020.07.13.00.40.45; Mon, 13 Jul 2020 00:41:07 -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 S1726725AbgGMHiK (ORCPT + 99 others); Mon, 13 Jul 2020 03:38:10 -0400 Received: from verein.lst.de ([213.95.11.211]:49118 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725818AbgGMHiK (ORCPT ); Mon, 13 Jul 2020 03:38:10 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id B741F68B02; Mon, 13 Jul 2020 09:38:06 +0200 (CEST) Date: Mon, 13 Jul 2020 09:38:06 +0200 From: Christoph Hellwig To: Dominique Martinet Cc: Doug Nazar , 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: <20200713073806.GA14676@lst.de> References: <20200710085722.435850-1-hch@lst.de> <5bee3e33-2400-2d85-080e-d10cd82b0d85@nazar.ca> <20200711104923.GA6584@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200711104923.GA6584@nautica> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2020 at 12:49:23PM +0200, Dominique Martinet 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 Thanks, this looks good to me.