lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211021161942.5983-1-mj0123.lee@samsung.com>
Date:   Fri, 22 Oct 2021 01:19:43 +0900
From:   Manjong Lee <mj0123.lee@...sung.com>
To:     mj0123.lee@...sung.com, akpm@...ux-foundation.org,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org
Cc:     seunghwan.hyun@...sung.com, sookwan7.kim@...sung.com,
        nanich.lee@...sung.com, yt0928.kim@...sung.com,
        junho89.kim@...sung.com, jisoo2146.oh@...sung.com
Subject: [PATCH 1/1] mm: bdi: Initialize bdi_min_ratio when bdi unregister

Initialize min_ratio if it is set when bdi unregister.
It can prevent problems that may occur when bdi is removed
without resetting min_ratio.

For example.
1) insert external sdcard
2) set external sdcard's min_ratio 70
3) remove external sdcard without setting min_ratio 0
4) insert external sdcard
5) set external sdcard's min_ratio 70 << error occur(can't set)

Because when sdcard is removed, bdi_min_ratio value will remain.
Currently, the only way to reset bdi_ min_ratio is to reboot.

Signed-off-by: Manjong Lee <mj0123.lee@...sung.com>
---
 mm/backing-dev.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/backing-dev.c b/mm/backing-dev.c
index 4a9d4e27d0d9..ca53807be188 100644
--- a/mm/backing-dev.c
+++ b/mm/backing-dev.c
@@ -947,6 +947,11 @@ void bdi_unregister(struct backing_dev_info *bdi)
 	wb_shutdown(&bdi->wb);
 	cgwb_bdi_unregister(bdi);
 
+	/* if min ratio doesn't 0, it has to set 0 before unregister */
+	if (bdi->min_ratio) {
+		bdi_set_min_ratio(bdi, 0);
+	}
+
 	if (bdi->dev) {
 		bdi_debug_unregister(bdi);
 		device_unregister(bdi->dev);
-- 
2.32.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ