Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp926120pxp; Wed, 16 Mar 2022 21:33:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZ1jGS0qb1q9+3eBAtHnBLddMp0y+gpNRYQ7wsMoX8KG08qifaSun8wRbCuEbdoqnpyXrA X-Received: by 2002:a63:5f92:0:b0:381:268:7863 with SMTP id t140-20020a635f92000000b0038102687863mr2190080pgb.247.1647491598733; Wed, 16 Mar 2022 21:33:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647491598; cv=none; d=google.com; s=arc-20160816; b=W2TCT0cji9bsN0jZ/i/N8mcDoniTbiqrMaBEmknd8kxVmxCgt51mZPtetI82JWM1Ld RMf2x6v2/efboJ9bS/iDFB9/UE+se0Z+IeUkrp5siPRZids1fJII8MAYYPStgLONjByE A3iC2t8eIfdi0DfGvCFJuRU//vxDoemxoizNSdvNdWU89FjE2fz9A/adBKZf0kM5pjUr A0xoSQh0vUEATcDE8apXIqk4AhVbq/Y5EWp2e572x6hm8fNJglmvNvoUNjDQ2FrCxmop 5zQPvycmu/O1nJ5nkhNA9I9lqZMsN3gZd+5/BeL3eLTeSq4oK6pEnXZm547jxsjUHTkq Arxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Yvklv52bmDHHgGtOlWyrtpymqsD6FZYMnmuc6QnE6/E=; b=N/C9F1NemgvxTl2iAv4jGEXuWrm34fI7PZtiOqAZX73ENMfXmvy3LioSxX0X3wGL9u nfMx7DRyH8frGvV+ReH6SeLRVeRyDF/xGeS7MjH0ISkYb8M20/8+HFXO5gWhiGLZkhOK hcf+q1YEFBqfS3qUDadb0U2Zkxcivdk3RC5A6rTBFhxz6q/TK7SzE4ee5+XJaB/cMV+U NjdpVY76umpfd3bTNMftGhgtx7pXmyzaM6MkknTX23Em2vueQijSY3z0EfgDWPByd4bc lGa/bTNfJqYRkjQuG7QTmOUWyOZWTjNbu7V4ve9jkY/BC3XaZqYHGsVXjXGBy0JrB2W+ xbyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SGd6PzOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u11-20020a63454b000000b003816043ef43si974703pgk.312.2022.03.16.21.33.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Mar 2022 21:33:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SGd6PzOz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6618F8B6CB; Wed, 16 Mar 2022 21:01:25 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235357AbiCNMVe (ORCPT + 99 others); Mon, 14 Mar 2022 08:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240734AbiCNMLe (ORCPT ); Mon, 14 Mar 2022 08:11:34 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D85F833A39; Mon, 14 Mar 2022 05:10:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 9BA87B80DF4; Mon, 14 Mar 2022 12:10:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CFADC340EC; Mon, 14 Mar 2022 12:10:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1647259822; bh=/ysTpHMR/qo7lmvua99zXU/quYDGz2gZ/U7+mWVtzZo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SGd6PzOzZMgZL1EZQ9RbUPyk28chcQ9n2dQdg/pfjIQS8u+aCMXLUy0BMk4srhHco RVmn6XuXWER3sTACK1HlXiKbQQvcTxP1H3ADselaQyCpqXA+2uMlfC5kw4ifSkpW4/ kGt6BRUbIetaXWTg0adl1xJMVfpDXNSxTVV2oWAI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jann Horn , David Howells , Linus Torvalds Subject: [PATCH 5.15 097/110] watch_queue: Fix the alloc bitmap size to reflect notes allocated Date: Mon, 14 Mar 2022 12:54:39 +0100 Message-Id: <20220314112745.733992680@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220314112743.029192918@linuxfoundation.org> References: <20220314112743.029192918@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 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 From: David Howells commit 3b4c0371928c17af03e8397ac842346624017ce6 upstream. Currently, watch_queue_set_size() sets the number of notes available in wqueue->nr_notes according to the number of notes allocated, but sets the size of the bitmap to the unrounded number of notes originally asked for. Fix this by setting the bitmap size to the number of notes we're actually going to make available (ie. the number allocated). Fixes: c73be61cede5 ("pipe: Add general notification queue support") Reported-by: Jann Horn Signed-off-by: David Howells Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/watch_queue.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -244,6 +244,7 @@ long watch_queue_set_size(struct pipe_in goto error; } + nr_notes = nr_pages * WATCH_QUEUE_NOTES_PER_PAGE; ret = pipe_resize_ring(pipe, roundup_pow_of_two(nr_notes)); if (ret < 0) goto error; @@ -269,7 +270,7 @@ long watch_queue_set_size(struct pipe_in wqueue->notes = pages; wqueue->notes_bitmap = bitmap; wqueue->nr_pages = nr_pages; - wqueue->nr_notes = nr_pages * WATCH_QUEUE_NOTES_PER_PAGE; + wqueue->nr_notes = nr_notes; return 0; error_p: