Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp4871110pxb; Mon, 28 Mar 2022 04:54:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2E6hIFFUnAysZW51luoGeKU/b9YCdcUy7cDjdR7cYPaKNIBaWdU1M57obIOAi61cB6zZm X-Received: by 2002:a17:903:1c3:b0:154:1831:39ee with SMTP id e3-20020a17090301c300b00154183139eemr25466621plh.84.1648468481841; Mon, 28 Mar 2022 04:54:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1648468481; cv=pass; d=google.com; s=arc-20160816; b=HpAOSZWkv0W40+4krFA4F7DB9dIzbXyKsIWVAP1Ws6+8NaBqOhFe9DjJNnoOoDgk3C InFb70oOa67jEisKtodQz8BH82X/tS/Jg2U1VgocHEklwUBWIaqSNw5mr2g1qepZP+nY 0b/UmcJgUGgBPSfow1BEKeasEuwRc3N+DcoPm3j0UN88LYkiwbFYk103HAGclo0gYkK+ FsGDXS7v118NyzkWe4UT+QTaMZXqs4Lp7gLVhFch3ZLocVmZIhC/buGixFjcmT9bTIQB U7qbzxw9br78c+yLIwToJ3ixrTB/Dm4nUJJXwkhvVpDqu59O1/oXF8DWaVFVhrOQOLVA ez+w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=8ryXOoKRSeSj62X041ZptO6D0BqyP7/awmvCaEC3goQ=; b=IscN6nTXa1EX73Zs0sTS6gK4Rf6aPNe3S7rt4mIVa56Gu398I3GF8wU+gi3mhn7GZe HnBQrvWUzODvgkoVkB6F0RbqtmyTvU88Z6Pdzjy8txWEvWc8tSY4HHaDA9vSsDpmM34D 6zVTyxgSJHj3SiUVEv8nZ3id1FzQD7DORr4HKJ8ozM2IFHLMKp3J7FH+9QhMSXaMl3Gw P1OXvJpZjuNQuGJwshaaZ2/jwRpzUQFT6WPYTqQQRxbYpTVWqLjXRb/pHS1lISCDFlT5 B2uOVVphH6xKwGZ6CriijKbhiBaLI8a/v8QE7ATNBAtAbjldb7ScuIXPmWqO46lcBAU8 LCRw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@anirudhrb.com header.s=zoho header.b=NKaXLtVA; arc=pass (i=1 spf=pass spfdomain=anirudhrb.com dkim=pass dkdomain=anirudhrb.com dmarc=pass fromdomain=anirudhrb.com>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a056a0002d000b004fa852292b0si11771449pft.308.2022.03.28.04.54.30; Mon, 28 Mar 2022 04:54:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@anirudhrb.com header.s=zoho header.b=NKaXLtVA; arc=pass (i=1 spf=pass spfdomain=anirudhrb.com dkim=pass dkdomain=anirudhrb.com dmarc=pass fromdomain=anirudhrb.com>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235886AbiC0Pvj (ORCPT + 99 others); Sun, 27 Mar 2022 11:51:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234251AbiC0Pvi (ORCPT ); Sun, 27 Mar 2022 11:51:38 -0400 Received: from sender4-of-o53.zoho.com (sender4-of-o53.zoho.com [136.143.188.53]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E04E2656F for ; Sun, 27 Mar 2022 08:49:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648396192; cv=none; d=zohomail.com; s=zohoarc; b=RcvQOByGXY1unKdCDaOAC1LXz+mMzM43DKPB5bsS7he8xMlBOQ9iftL4k8yCob8vJvJqWzZxyHwpFBbNz3Ao/PQy/BGCPhEWO51iydLTr5wnr5Fm9leoZxuFUa/Pl+PYyzcDPhqTshv51XfZgb7pMKo4MdTjcth/9nirZjCADfk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1648396192; h=Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=8ryXOoKRSeSj62X041ZptO6D0BqyP7/awmvCaEC3goQ=; b=Tg2GYmu667sTaIw7UUNqpS36/3Jdmgfl33zsLJU3BpOw97jipJ0Nto1TyQJodAaOGk3i/nnC2mPRSDRwC6iI9JomeAXo8tbeNU1I87TKe0vOflLac4r1f/UTCVITMcf7TFRpUFFgJda9LILqCC+9e5/GD6Gqkrnp/CX5HJYrm4E= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=anirudhrb.com; spf=pass smtp.mailfrom=mail@anirudhrb.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1648396192; s=zoho; d=anirudhrb.com; i=mail@anirudhrb.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Message-Id:Message-Id:MIME-Version:Content-Transfer-Encoding:Reply-To; bh=8ryXOoKRSeSj62X041ZptO6D0BqyP7/awmvCaEC3goQ=; b=NKaXLtVA0nzqNngOwmr9FKIYWnsCiFxPqCU78hC0eXc8NGKqxYwIKWnu9IHEu7sj 0NWAlK3Gtq72gptaxHS2AZkaDpBGxTES+reSup/uQA0NWbeRl/ZDiX9Kc9TAIpuiSjE x/f5b/Idr7FN6++AKJZQHevU9Awms/+C6bU1y2Do= Received: from localhost.localdomain (49.207.212.179 [49.207.212.179]) by mx.zohomail.com with SMTPS id 1648396189292143.7738007891578; Sun, 27 Mar 2022 08:49:49 -0700 (PDT) From: Anirudh Rayabharam To: David Howells , Anirudh Rayabharam , Christophe JAILLET , "Fabio M. De Francesco" Cc: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com, linux-kernel@vger.kernel.org Subject: [PATCH] watch_queue: free the notes array Date: Sun, 27 Mar 2022 21:19:33 +0530 Message-Id: <20220327154936.9353-1-mail@anirudhrb.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-ZohoMailClient: External X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 __put_watch_queue() frees the individual notifications but doesn't free the notes array itself causing a memory leak. Reported by syzbot at: https://syzkaller.appspot.com/bug?extid=25ea042ae28f3888727a Fix by adding a kfree(). Fixes: c73be61cede5 ("pipe: Add general notification queue support") Reported-by: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com Tested-by: syzbot+25ea042ae28f3888727a@syzkaller.appspotmail.com Signed-off-by: Anirudh Rayabharam --- kernel/watch_queue.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/watch_queue.c b/kernel/watch_queue.c index 3990e4df3d7b..230038d4f908 100644 --- a/kernel/watch_queue.c +++ b/kernel/watch_queue.c @@ -370,6 +370,7 @@ static void __put_watch_queue(struct kref *kref) for (i = 0; i < wqueue->nr_pages; i++) __free_page(wqueue->notes[i]); + kfree(wqueue->notes); bitmap_free(wqueue->notes_bitmap); wfilter = rcu_access_pointer(wqueue->filter); -- 2.35.1