From patchwork Tue Oct 19 10:33:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrea Righi X-Patchwork-Id: 1543192 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=MKUwkq+r; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HYVT90pGHz9sPf for ; Tue, 19 Oct 2021 21:33:31 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1mcmQs-0001R5-KB; Tue, 19 Oct 2021 10:33:22 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1mcmQq-0001Ql-Hw for kernel-team@lists.ubuntu.com; Tue, 19 Oct 2021 10:33:20 +0000 Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id 679124005D for ; Tue, 19 Oct 2021 10:33:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1634639600; bh=OAi2qCKRRTQFfaY+AXxKC719fpS1Z1N1LKLFA2gZ2pQ=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=MKUwkq+rUvaoC8TlseeDmNAvvguy7I+PZZY4q6RN82b48AqwH3wWWItn9dcuK8UY+ 8lbSuEPmiUMoPBTN5J/V4KxB8W3o2PmkGcqTWvX/nEegRhTbfvwMAcQepdWH3GrRK0 KnAaV58HnGSJcJS/fSxsCmLNyybTXeNM0d1Qh1/Ky+VVi9dFSnD/erHpBfjOrto8ib y5lBYkyMNPnHHXCtvUjIJjeNknYBMTX2wMrtzSkTH/yqsmc99Tg2vq3IFes/TjSn3O DXE55iViQrIjdqjuesThqQwXmIyznKq5likYS+LPxbDOoTQEaw2qD+suZs02U19XBm Ps6RoNYVvqXvw== Received: by mail-ed1-f71.google.com with SMTP id c30-20020a50f61e000000b003daf3955d5aso17187843edn.4 for ; Tue, 19 Oct 2021 03:33:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=OAi2qCKRRTQFfaY+AXxKC719fpS1Z1N1LKLFA2gZ2pQ=; b=VgWlnhRfADscM9ZuF/GqKWDpCk0C0S7PH7i5vn7R1dgw+BDV8C3TmHyeCCuQM/nUEz vulSsKyupAiurQqe+cJ+jOmz9bLJLG6fFP1EEW0InbnZNb1UUD4lo0gW1LB5817/T7uw 77ZFKDPwP0VINK/CC2qNoJ/lIRLdUzbEE3tBTO8u7Io9KEJHvfyaZvI9mJY2Y9Txd0wh +6GGypQD2NDHaCMCAYGl3FD/NnY/M8DdLDAaJhqVzZJKud3hdPEOgTkroYvEOqG3rwOd 5Y96peuMrUrsXqa9g6AnCkgKORyNHfRvJaHC6d5P/cHOYXFbFh6NrrnsDyOY+kQR74hu XZTQ== X-Gm-Message-State: AOAM530k1j8wyy8+XFlaNbwBLTxK+OUToiyQij0aP3CYnXg7uZTpzPN6 5MfthbdraPcuVA60TkrSHdShA1hz6ypD+B0PzVfQyG+O+wvurOSuZb1qrCYBmBiVSepuAhJYZZM gXLmdGGDf8iv3SfKTemALNPtPxYtBWHiHodMIU6F/+g== X-Received: by 2002:a17:906:a106:: with SMTP id t6mr36499152ejy.170.1634639600138; Tue, 19 Oct 2021 03:33:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwcfsex/9NnaqiNtotFttMCiOQoENL/6PmZyUSZNqdhCPqZPdXFTnI6AYqmolTLlaUn3BmLDA== X-Received: by 2002:a17:906:a106:: with SMTP id t6mr36499130ejy.170.1634639599961; Tue, 19 Oct 2021 03:33:19 -0700 (PDT) Received: from arighi-desktop.homenet.telecomitalia.it ([2001:67c:1560:8007::aac:c1b6]) by smtp.gmail.com with ESMTPSA id la1sm10066166ejc.48.2021.10.19.03.33.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Oct 2021 03:33:19 -0700 (PDT) From: Andrea Righi To: kernel-team@lists.ubuntu.com Subject: [SRU][J/I/H/F][PATCH 1/1] Revert "UBUNTU: SAUCE: cachefiles: Page leaking in cachefiles_read_backing_file while vmscan is active" Date: Tue, 19 Oct 2021 12:33:08 +0200 Message-Id: <20211019103307.27519-2-andrea.righi@canonical.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211019103307.27519-1-andrea.righi@canonical.com> References: <20211019103307.27519-1-andrea.righi@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" BugLink: https://bugs.launchpad.net/bugs/1947709 The following upstream commit is already fixing the page leaking: 9a24ce5b66f9 ("cachefiles: Fix page leak in cachefiles_read_backing_file while vmscan is active") This SAUCE patch is not needed anymore, and even worse, it's adding a potential NULL pointer dereference in cachefiles_read_backing_file(), because we do a put_page(newpage) and set newpage = NULL in the main loop in case of -EEXIST and afterwards we call put_page(newpage) again. Dropping the SAUCE patch is enough to have the page leaking issue fixed and prevent the NULL pointer dereference. Signed-off-by: Andrea Righi --- fs/cachefiles/rdwr.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/cachefiles/rdwr.c b/fs/cachefiles/rdwr.c index 0fa644116834..8ffc40e84a59 100644 --- a/fs/cachefiles/rdwr.c +++ b/fs/cachefiles/rdwr.c @@ -507,8 +507,6 @@ static int cachefiles_read_backing_file(struct cachefiles_object *object, goto installed_new_backing_page; if (ret != -EEXIST) goto nomem; - put_page(newpage); - newpage = NULL; } /* we've installed a new backing page, so now we need