Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2245868pxp; Mon, 21 Mar 2022 14:52:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzAxPiCpXt2SKxHdtndv/k1Xu4e4mhtXFhaOd2FdXAKqhap+X7/kBbhR6plnkmCI+COtMKL X-Received: by 2002:a17:902:d48d:b0:154:54f6:9384 with SMTP id c13-20020a170902d48d00b0015454f69384mr7597254plg.83.1647899561716; Mon, 21 Mar 2022 14:52:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647899561; cv=none; d=google.com; s=arc-20160816; b=yzPBji/DFB15Q2IBAlP6U/QXHskQzp75hAalgmrlxS1Gnye3WThAMuT2rurlGLehgi +Fsw4bqAPog+BJCI8hQKWia/D0tYxbnZuJYwmpT3aVCyV054fQNHWfCcvjO0Pr1DUvxj dwG2VzRMrt27UfRv+22zBWRSpZv2povpvwsv92Zsf1xLfes78bQ4+q+kP8XBCN901g/J Bx+oaawO65Y1+cbuvUaZQKXZviaDlCVPVBs+T5Wuho6TnIVTbddBSsENYrFki/+QDugU lympfC0zH8BXtCFiCm14Q7/1eRjN5VFzycKDZV4vUXMCZdgIpMkH/jZhk9Pw2MZr2sGk GXuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:references:in-reply-to:from :organization:dkim-signature; bh=CKsx9lB6p9WZgwNtKRiFWqPlet0kE4LtzkeugjgOYxw=; b=xqdDH86qrxEVPdWtQlmIELB6ck3SppPJcOuAMD56T4CmKgfb9bw7Tcz5DLz9g/kn8O jD8aUNo32ZhDTNOmTylDyJACX1Kfs0VLydGdUxKukBYWz9bxDffWia7+LEyfe5u314it YrXGlIWQt1WbCYKuuF6Amf8iZ52eln+fT5pSOFddyGircoFTkLEvIsV7vXYcVcMvh0rs DwrQUCTfOtF9pOc0Bi54S42dMXinA1Xkz2qoOuXA6Qr9ChdevVpkjwVEHzNmozNlpJ8w eo+h15BewcaahEzeuPenb3zVLsDRVpn3mTtkGolDbG3YRYyKY970YkjB8+Ir3dUQ7xp2 6gEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g8tFGSws; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 125-20020a630483000000b00382295afcf7si13549105pge.634.2022.03.21.14.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 14:52:41 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=g8tFGSws; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id CDBF22B5ACA; Mon, 21 Mar 2022 14:20:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244365AbiCUJjf (ORCPT + 99 others); Mon, 21 Mar 2022 05:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34578 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbiCUJjb (ORCPT ); Mon, 21 Mar 2022 05:39:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8BDA4DF4 for ; Mon, 21 Mar 2022 02:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647855482; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CKsx9lB6p9WZgwNtKRiFWqPlet0kE4LtzkeugjgOYxw=; b=g8tFGSwsSAAPj0jchcr5axtMYkZYVoXwoFu2llviMMuKHEFp0jlnL6DOt/ViPYOn/ZmprV bk6/K04/6y4c2a5K8LP7T8ADhwAaRFfUmAC4BHBFiKE9CVEvb//Wgfme7rwICBqdDJlGR8 /lzAjCtDb2DDGMvNT0VXBYLA2ygnrTc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-322-jCMNr4XVNeSNL75jysd6Mg-1; Mon, 21 Mar 2022 05:37:58 -0400 X-MC-Unique: jCMNr4XVNeSNL75jysd6Mg-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7D0411044562; Mon, 21 Mar 2022 09:37:58 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.36.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id AFA01400E11D; Mon, 21 Mar 2022 09:37:57 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <1745593.TLkxdtWsSY@leap> References: <1745593.TLkxdtWsSY@leap> <1821968.CQOukoFCf9@leap> <000000000000b1807c05daad8f98@google.com> <977073.1647852411@warthog.procyon.org.uk> To: "Fabio M. De Francesco" Cc: dhowells@redhat.com, christophe.jaillet@wanadoo.fr, linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Subject: Re: [syzbot] KASAN: null-ptr-deref Read in __free_pages MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <985900.1647855477.1@warthog.procyon.org.uk> Content-Transfer-Encoding: quoted-printable Date: Mon, 21 Mar 2022 09:37:57 +0000 Message-ID: <985901.1647855477@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.84 on 10.11.54.2 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fabio M. De Francesco wrote: > I cannot have any objection, it's up to you to decide :) Of course you can object. That's kind of the point of a review;-) How about the attached instead, then? David --- --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -271,9 +271,8 @@ long watch_queue_set_size(struct pipe_inode_info *pipe= , unsigned int nr_notes) return 0; = error_p: - for (i =3D 0; i < nr_pages; i++) - if (pages[i]) - __free_page(pages[i]); + while (--i >=3D 0) + __free_page(pages[i]); kfree(pages); error: (void) account_pipe_buffers(pipe->user, nr_pages, pipe->nr_accounted);