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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190109183920.GA22070@lst.de>
Date:   Wed, 9 Jan 2019 19:39:20 +0100
From:   Christoph Hellwig <hch@....de>
To:     Hongbo Yao <yaohongbo@...wei.com>
Cc:     wangxiongfeng2@...wei.com, guohanjun@...wei.com,
        huawei.libin@...wei.com, thunder.leizhen@...wei.com,
        tanxiaojun@...wei.com, xiexiuqi@...wei.com,
        yangyingliang@...wei.com, cj.chengjian@...wei.com,
        wxf.wang@...ilicon.com, keith.busch@...el.com, axboe@...com,
        hch@....de, sagi@...mberg.me, linux-nvme@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nvme: fix out of bounds access in nvme_cqe_pending

On Mon, Jan 07, 2019 at 10:22:07AM +0800, Hongbo Yao wrote:
> There is an out of bounds array access in nvme_cqe_peding().
> 
> When enable irq_thread for nvme interrupt, there is racing between the
> nvmeq->cq_head updating and reading.

Just curious: why did you enable this option?  Do you have a workload
where it matters?

> diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
> index d668682..68375d4 100644
> --- a/drivers/nvme/host/pci.c
> +++ b/drivers/nvme/host/pci.c
> @@ -908,9 +908,11 @@ static void nvme_complete_cqes(struct nvme_queue *nvmeq, u16 start, u16 end)
>  
>  static inline void nvme_update_cq_head(struct nvme_queue *nvmeq)
>  {
> -	if (++nvmeq->cq_head == nvmeq->q_depth) {
> +	if (nvmeq->cq_head == (nvmeq->q_depth - 1)) {
>  		nvmeq->cq_head = 0;
>  		nvmeq->cq_phase = !nvmeq->cq_phase;
> +	} else {
> +		++nvmeq->cq_head;

No need for the braces above, but otherwise this looks fine.  I'll apply
it to nvme-4.21.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ