Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2660353imj; Mon, 11 Feb 2019 06:37:28 -0800 (PST) X-Google-Smtp-Source: AHgI3IY6SCqxuQydd7jmlECugMrRjgkIni70N1XsOFRuSJMQIoWWEf/kDvCVtR9UCvCEy62Uxplr X-Received: by 2002:a63:5922:: with SMTP id n34mr23881236pgb.435.1549895848144; Mon, 11 Feb 2019 06:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549895848; cv=none; d=google.com; s=arc-20160816; b=mOPBWdq6Qjrs6+rv2z/jwWVJnOkuYTde27wJIK7DbaoQWKB6brompye5xVYxPddtRW eCfvpNJgaxzRbCT53SIZfhk79IqbuxbdfftUDFZhtl3ncaV4ygtzD00esNLWyr/palI/ 2sP+qGff/1cUJsVdAHavgDokWSscEVUFoylufCSECPoD9tapgWiKHuLNy2mQkXNVD9lI /ydg08NclQGF5ZSlwZ7WGbjITB/rrcRWyoljAwE0/7jw3jPn45tTxYOtGQ5I6314OW44 IWCBv4MSUhPWFELP1ZFLDNNqASLvcJO5NdNmUlSLDsfXmrP5KCV4UOdl7rC6fGF2kz09 AXQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uDhq4gRgXsHzlCANkPJUD4au8jAEgh2twdy9FqohmWg=; b=w3mE3uVMcxMkHRV+SSUKrKn9Q1HLl2X0/1KbMHNkiaUyPtgHKwRRy6imawH2HnxY1S YpBsdX0mCm9I8W4DKcQ4BuNGMFQHkQ2LtrSrKSxtBf8gCyrkOgy1ZDlDPyN4Qm05XgHx nzVY3+fcMM1x/kNLZDRFnm6bRtKQBOUfFx+1YHbLyrqkDKpA46DQgj2C34CLqQx7LyTn jdOKBcoIhAGRLjN1K2jtbw7RdJJ454xs+764Rr9jzr2sLy57Xl2fSFlN4Y94w3OGOb3b 3hlH8VXOUNxu3NL5rIk+lnE7JaFA+1/6URd48K6zOrURqj6x1zn/EPvZjKxVdkrmWebK hQcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="wij3z/S2"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k11si10248860plt.68.2019.02.11.06.37.11; Mon, 11 Feb 2019 06:37:28 -0800 (PST) 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=@kernel.org header.s=default header.b="wij3z/S2"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731226AbfBKOgU (ORCPT + 99 others); Mon, 11 Feb 2019 09:36:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:45366 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730857AbfBKOgT (ORCPT ); Mon, 11 Feb 2019 09:36:19 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 464C220818; Mon, 11 Feb 2019 14:36:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895778; bh=rVtTk+QgayrDc/Y4Ab27N6xeerm92OxOwW39Rf67HSU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wij3z/S2Ef4zED+m6dKxyFhoK8ZIX0t6AUidajXj9g8YtE9jNrgHt0pO/tByB+tWp v2j/kkHtX/2pTmBVIGXnWigRJIAXUaDzkV1UoIXHyiTusdaFMsp75Uf4riY2y6s+NS zLMtNkk/62zZV3334Bp85sAj3mPnMXsub9JNcvYU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , Miklos Szeredi Subject: [PATCH 4.20 320/352] fuse: call pipe_buf_release() under pipe lock Date: Mon, 11 Feb 2019 15:19:07 +0100 Message-Id: <20190211141907.183129349@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jann Horn commit 9509941e9c534920ccc4771ae70bd6cbbe79df1c upstream. Some of the pipe_buf_release() handlers seem to assume that the pipe is locked - in particular, anon_pipe_buf_release() accesses pipe->tmp_page without taking any extra locks. From a glance through the callers of pipe_buf_release(), it looks like FUSE is the only one that calls pipe_buf_release() without having the pipe locked. This bug should only lead to a memory leak, nothing terrible. Fixes: dd3bb14f44a6 ("fuse: support splice() writing to fuse device") Cc: stable@vger.kernel.org Signed-off-by: Jann Horn Signed-off-by: Miklos Szeredi Signed-off-by: Greg Kroah-Hartman --- fs/fuse/dev.c | 2 ++ 1 file changed, 2 insertions(+) --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2077,8 +2077,10 @@ static ssize_t fuse_dev_splice_write(str ret = fuse_dev_do_write(fud, &cs, len); + pipe_lock(pipe); for (idx = 0; idx < nbuf; idx++) pipe_buf_release(pipe, &bufs[idx]); + pipe_unlock(pipe); out: kvfree(bufs);