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-prev] [day] [month] [year] [list]
Message-ID: <BYAPR21MB1270BBC14D5F1AE69FC31A16BFB09@BYAPR21MB1270.namprd21.prod.outlook.com>
Date:   Wed, 6 Oct 2021 17:28:37 +0000
From:   Dexuan Cui <decui@...rosoft.com>
To:     John Garry <john.garry@...wei.com>,
        Michael Kelley <mikelley@...rosoft.com>,
        KY Srinivasan <kys@...rosoft.com>,
        Stephen Hemminger <sthemmin@...rosoft.com>,
        "wei.liu@...nel.org" <wei.liu@...nel.org>,
        "jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
        "martin.petersen@...cle.com" <martin.petersen@...cle.com>,
        Haiyang Zhang <haiyangz@...rosoft.com>,
        "ming.lei@...hat.com" <ming.lei@...hat.com>,
        "bvanassche@....org" <bvanassche@....org>,
        "linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
        "linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH] scsi: storvsc: Cap scsi_driver.can_queue to fix a hang
 issue during boot

> From: John Garry <john.garry@...wei.com>
> Sent: Wednesday, October 6, 2021 9:03 AM
> >> ...
> >>> +	if (scsi_driver.can_queue > SHRT_MAX)
> >>> +		scsi_driver.can_queue = SHRT_MAX;
> >>> +
> >
> > This fix works, but is a more of a temporary hack until I can finish
> > a larger overhaul of the algorithm.
> 
> > But for now, I think the better
> > fix is for ea2f0f77538c to do the comparison as "int" instead of "short".
> >
> 
> That seems better to me. But Let's wait for other possible opinion.
> 
> Thanks,
> John

It looks like shost->cmd_per_lun has been "short" since day 1.
I don't know whether it should be changed to unsigned int.

Thanks for the thoughts! I'll post a v2 like the below in 24 hours.

diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
index 3f6f14f0cafb..24b72ee4246f 100644
--- a/drivers/scsi/hosts.c
+++ b/drivers/scsi/hosts.c
@@ -220,7 +220,8 @@ int scsi_add_host_with_dma(struct Scsi_Host *shost, struct device *dev,
                goto fail;
        }

-       shost->cmd_per_lun = min_t(short, shost->cmd_per_lun,
+       /* Use min_t(int, ...) in case shost->can_queue exceeds SHRT_MAX */
+       shost->cmd_per_lun = min_t(int, shost->cmd_per_lun,
                                   shost->can_queue);

        error = scsi_init_sense_cache(shost)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ