[PATCH 3/3] nvme-core: fix crash when nvme_enable_aen timeout

Christoph Hellwig hch at lst.de
Fri Aug 21 03:49:10 EDT 2020


On Thu, Aug 20, 2020 at 02:43:20PM +0800, Chao Leng wrote:
>>> -static void nvme_enable_aen(struct nvme_ctrl *ctrl)
>>> +static int nvme_enable_aen(struct nvme_ctrl *ctrl)
>>>   {
>>>       u32 result, supported_aens = ctrl->oaes & NVME_AEN_SUPPORTED;
>>>       int status;
>>>       if (!supported_aens)
>>> -        return;
>>> +        return 0;
>>>       status = nvme_set_features(ctrl, NVME_FEAT_ASYNC_EVENT, supported_aens,
>>>               NULL, 0, &result);
>>> -    if (status)
>>> +    if (status) {
>>>           dev_warn(ctrl->device, "Failed to configure AEN (cfg %x)\n",
>>>                supported_aens);
>>> +        if (status < 0)
>>> +            return status;
>>
>> Why do you need to check status < 0, you need to fail it regardless.
>
> agree.
> Just want to keep the old logic. I guess the old logic: if supported_aens
> is true, the result of set features can ignore.
>
> If there is no objection to doing so, I will resend the patch later.

In the past we've dedice to ignore real NVMe errors in various
spots as the functionality wasn't deemed critical.  I think that is
pretty sloppy and we should only do that where we really have to.



More information about the Linux-nvme mailing list