From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FDB9C43603 for ; Mon, 16 Dec 2019 17:46:21 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7E17220717 for ; Mon, 16 Dec 2019 17:46:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726133AbfLPRqU (ORCPT ); Mon, 16 Dec 2019 12:46:20 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:58312 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725805AbfLPRqU (ORCPT ); Mon, 16 Dec 2019 12:46:20 -0500 Received: from viro by ZenIV.linux.org.uk with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1iguRk-00066U-BG; Mon, 16 Dec 2019 17:46:16 +0000 Date: Mon, 16 Dec 2019 17:46:16 +0000 From: Al Viro To: Jan Kara Cc: David Howells , linux-fsdevel@vger.kernel.org Subject: Re: [PATCH] pipe: Fix bogus dereference in iov_iter_alignment() Message-ID: <20191216174616.GN4203@ZenIV.linux.org.uk> References: <20191216105432.5969-1-jack@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191216105432.5969-1-jack@suse.cz> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org On Mon, Dec 16, 2019 at 11:54:32AM +0100, Jan Kara wrote: > We cannot look at 'i->pipe' unless we know the iter is a pipe. Move the > ring_size load to a branch in iov_iter_alignment() where we've already > checked the iter is a pipe to avoid bogus dereference. > > Reported-by: syzbot+bea68382bae9490e7dd6@syzkaller.appspotmail.com > Fixes: 8cefc107ca54 ("pipe: Use head and tail pointers for the ring, not cursor and length") > Signed-off-by: Jan Kara > --- > lib/iov_iter.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > Al, David, not sure who's going to merge this so sending to both :). Applied, will push tonight.