]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ext4: add positive int attr pointer to avoid sysfs variables overflow
authorBaokun Li <libaokun1@huawei.com>
Tue, 19 Mar 2024 11:33:22 +0000 (19:33 +0800)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 3 May 2024 03:48:30 +0000 (23:48 -0400)
commit63bfe841053f8dda09c9d059d543486d9dc16104
treeda12e11e41e220f41f031e30efa1f83777b78800
parentb7b2a5799b8fafe95fcd5455c32ba2c643c86f99
ext4: add positive int attr pointer to avoid sysfs variables overflow

The following variables controlled by the sysfs interface are of type
int and are normally used in the range [0, INT_MAX], but are declared as
attr_pointer_ui, and thus may be set to values that exceed INT_MAX and
result in overflows to get negative values.

  err_ratelimit_burst
  msg_ratelimit_burst
  warning_ratelimit_burst
  err_ratelimit_interval_ms
  msg_ratelimit_interval_ms
  warning_ratelimit_interval_ms

Therefore, we add attr_pointer_pi (aka positive int attr pointer) with a
value range of 0-INT_MAX to avoid overflow.

Signed-off-by: Baokun Li <libaokun1@huawei.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Link: https://lore.kernel.org/r/20240319113325.3110393-7-libaokun1@huawei.com
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
fs/ext4/sysfs.c