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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51c2d9da-a0c5-8ae5-5c22-ceb56c7f5a27@acm.org>
Date:   Tue, 15 Mar 2022 07:33:34 -0700
From:   Bart Van Assche <bvanassche@....org>
To:     John Garry <john.garry@...wei.com>,
        damien.lemoal@...nsource.wdc.com, jejb@...ux.ibm.com,
        martin.petersen@...cle.com, ming.lei@...hat.com, hch@....de,
        hare@...e.de
Cc:     linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org,
        linux-scsi@...r.kernel.org, martin.wilck@...e.com
Subject: Re: [PATCH 1/2] scsi: core: Fix sbitmap depth in
 scsi_realloc_sdev_budget_map()

On 3/15/22 03:39, John Garry wrote:
> In commit edb854a3680b ("scsi: core: Reallocate device's budget map on
> queue depth change"), the sbitmap for the device budget map may be
> reallocated after the slave device depth is configured.
> 
> When the sbitmap is reallocated we use the result from
> scsi_device_max_queue_depth() for the sbitmap size, but don't resize to
> match the actual device queue depth.
> 
> Fix by resizing the sbitmap after reallocating the budget sbitmap.
> 
> Signed-off-by: John Garry <john.garry@...wei.com>
> ---
>   drivers/scsi/scsi_scan.c | 5 +++++
>   1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/scsi/scsi_scan.c b/drivers/scsi/scsi_scan.c
> index f4e6c68ac99e..2ef78083f1ef 100644
> --- a/drivers/scsi/scsi_scan.c
> +++ b/drivers/scsi/scsi_scan.c
> @@ -223,6 +223,8 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev,
>   	int ret;
>   	struct sbitmap sb_backup;
>   
> +	depth = min_t(unsigned int, depth, scsi_device_max_queue_depth(sdev));
> +
>   	/*
>   	 * realloc if new shift is calculated, which is caused by setting
>   	 * up one new default queue depth after calling ->slave_configure
> @@ -245,6 +247,9 @@ static int scsi_realloc_sdev_budget_map(struct scsi_device *sdev,
>   				scsi_device_max_queue_depth(sdev),
>   				new_shift, GFP_KERNEL,
>   				sdev->request_queue->node, false, true);
> +	if (!ret)
> +		sbitmap_resize(&sdev->budget_map, depth);

Hmm ... why to call both sbitmap_init_node() and sbitmap_resize() 
instead of combining both calls into a single call with the proper depth?

Thanks,

Bart.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ