From patchwork Mon Dec 9 16:57:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kairui Song X-Patchwork-Id: 13900059 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BC84E77182 for ; Mon, 9 Dec 2024 16:57:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 98B558D008B; Mon, 9 Dec 2024 11:57:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 93B128D0058; Mon, 9 Dec 2024 11:57:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80CDB8D008B; Mon, 9 Dec 2024 11:57:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 611EB8D0058 for ; Mon, 9 Dec 2024 11:57:47 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0164C80527 for ; Mon, 9 Dec 2024 16:57:46 +0000 (UTC) X-FDA: 82876026870.15.297B906 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf07.hostedemail.com (Postfix) with ESMTP id E2B3040003 for ; Mon, 9 Dec 2024 16:57:23 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=JvBDkUSu; spf=pass (imf07.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733763443; h=from:from:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=cs031+LjjX7QEYcyeO9AS0x5okeBcuxN8HhhB19UC3w=; b=0AQqKZ43C4gPmz5KjL6KD1Y7T9cT51Q9uambkcgZGD85zImu60wrtt6lumDjZ29ank5JG0 qP3Mzkawq+U2WiHpx2cDPL0ey2BOE8xLS97F1lAgddnBYeJ9rmHUrRvB6+VD9lfbZ07woG IxdRXvCyCy/W/yK1lxWpbMunSzo2y+Y= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=JvBDkUSu; spf=pass (imf07.hostedemail.com: domain of ryncsn@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=ryncsn@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733763443; a=rsa-sha256; cv=none; b=jq61BvzDRPmPN972/rQ0sQ39y9MsXTQqMLvn9+wo1mLsq+YHamwQDOafxpJDbV98B40I69 ewwYHv6Qq6HrBt3IRPit+9sPibLk9pMEIMxjrXnTOp0QCz6mUgd32DKE6K1rjBnaWpsrmO dded79Yy/nIwMXZhaSLoK7yPP3Ww7wQ= Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-7265c18d79bso823994b3a.3 for ; Mon, 09 Dec 2024 08:57:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733763463; x=1734368263; darn=kvack.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=cs031+LjjX7QEYcyeO9AS0x5okeBcuxN8HhhB19UC3w=; b=JvBDkUSuOBZSt25bg8crX77+biKATsfELIakWDCbXlp8/5bdqasatVWdta53LDqFMz K1esD0h+m6zy+p6gMPHcsx2on8b+tLybXevw1NHhEbKYWjMGFajKnaeN1mezaibJDhES sXMSn7ylMC6TKTdDWglBlZkV4ou1/xhMTj4cIWoDTpW8CjP1luUxpdpaMZBRCLPahpNO +DdOQ/uUfolgLGWWubyFG6uMQbv75q6/lALmgcHRXP+/zCiPslrP64kLiImo8oSDwv8f 9+AthJ6n0UyiqQ0+OJq+udN7POE+KPsAXZfmBcbtulyUENURBGklA/p2/QxhKTzy/chF 7cgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733763463; x=1734368263; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cs031+LjjX7QEYcyeO9AS0x5okeBcuxN8HhhB19UC3w=; b=kNSb2sOrgeyGKXOUpLYsg6e5vJ4mWuEoFuqAYdZi/c3YFF8kranoosbUioPO/UO7Y2 7fcEzMP4AbhO6aFRDyxgKgk608XSx+yxo61cDNISMJCCMSg0ipaoCwqPRvOY5fTBqqkO ffUcLP2ULUGQ+WAzT8pXHUSBULNsy+KBOfjGDpMS+AcSgU7Hf7cgfq4gVhLyVAM4Q9cb MWXycp/UvK7YJneYGU1swlb09K1wcbVq7f2Fn3+QWAKhv31nRkWTQbtBSAhCg4YGfl2U fvc9tCmbv5XN+EsSXqPfDQrhuQKsR+RZ1BR+QWAgfEahurfL6uKHw7ePRWG1bMdWzkAa Opog== X-Gm-Message-State: AOJu0YwsPYLXrnTSi2LEZPgBPJu5UDEbdPdwKUynvngf+iGjM10Jk6i3 dTPjfutdBgosh0LhW0DddhmP6EB8zMp2YpMZo5ROiYvJW63YLU1OgrjJwlmHlTQ= X-Gm-Gg: ASbGnctzVpvb57nvlwaHiwPdfVjGfo9wtz0m903DLfzqJp/5pPNeGNpluPq5m9av/d3 Vti0WzCQrZShkhKHGvx4xDF/NJ1Sg8Yx1SIC4cv2NTZ+tV78U4CwXt/R6Jo7JdPQ6aYs/8sCpwY TZPkwOzmtKyUAbczgK8A3ez+Bjb+/u/0enTHfiApZITQb0f+B2xA68ur1g8gQDkcEZ6OJu5L463 PsdOz20ScQkUGFxTBITSFKrtRnwQhin4hMxasmH7BYuA4DzPqC1iIGJHCymL1n8Q4HB9JA= X-Google-Smtp-Source: AGHT+IFT3pkLkxmkwXq1KmRuWWE/3LcEAyp+a28TxyNZrMBn+elZurcvgNklUPnITcsfJ+T1KQv2hQ== X-Received: by 2002:a05:6a00:10c5:b0:725:e309:7110 with SMTP id d2e1a72fcca58-725e30974e7mr9859365b3a.5.1733763463355; Mon, 09 Dec 2024 08:57:43 -0800 (PST) Received: from KASONG-MC4.tencent.com ([106.37.120.120]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7273c7f3f1fsm514201b3a.13.2024.12.09.08.57.41 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Mon, 09 Dec 2024 08:57:42 -0800 (PST) From: Kairui Song To: linux-mm@kvack.org Cc: Minchan Kim , Sergey Senozhatsky , Andrew Morton , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Kairui Song Subject: [PATCH v2 0/2] zram: fix backing device setup issue Date: Tue, 10 Dec 2024 00:57:14 +0800 Message-ID: <20241209165717.94215-1-ryncsn@gmail.com> X-Mailer: git-send-email 2.47.1 Reply-To: Kairui Song MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: E2B3040003 X-Rspam-User: X-Stat-Signature: rrxowif6rj3jen87hsy95s9i335g177d X-HE-Tag: 1733763443-158795 X-HE-Meta: U2FsdGVkX1/2Q8YRSvNpsTdiTnAn8DUtKHvNMqacvkdJ6aDgUsmDEkJi21SwwBOOPsmqN7zfpbEVDOhv3smqmwBi2bYHCMxDGKkGY678A+nrPHubCtyBb+CtOXh1G947CtwiFHnlUrrkj0pGcFNydFPQPWjHOIWRTY73KiYAwyDTn2/Wpo8tvEuCUJKwZJtgWDpvoa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iw3jWwGt46oTSFEViGVOsrdpfLP/La9QtiRHg7DqURfsNUhk0QCCcLw2xCB1LE3c6gEhmuQp0fx683KajIdgaVKzwEJIaSzxUjzZMr5t1x03ScjHKlUZFDp0KEPbmzTvT9OPVXYSA1wVkzmPfejBg7eprlN5DEYjoUuUEgtZ+0gZl4tXdJNaMvvNhwoLX5f0avxrivMR0Kyoe3yUCjK5raCzbSadWDxwlWPj/o9oMBE0Ww6Ax2kOCkZMvrry+vahJyQ4et/C7o04dpcsKFh7ZvbvwE X-Bogosity: Unsure, tests=bogofilter, spamicity=0.489058, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Kairui Song This series fixes two bugs of backing device setting: - ZRAM should reject using a zero sized (or the uninitialized ZRAM device itself) as the backing device. - Fix backing device leaking when removing a uninitialized ZRAM device. V1: https://lore.kernel.org/linux-mm/20241204180224.31069-1-ryncsn@gmail.com/ Update from V1: - Collect Review-by. - Update fix for issue 2 as suggested by Sergey Senozhatsky. Kairui Song (2): zram: refuse to use zero sized block device as backing device zram: fix uninitialized ZRAM not releasing backing device drivers/block/zram/zram_drv.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)