[PATCH 3/3] nvme-core: fix crash when nvme_enable_aen timeout
Chao Leng
lengchao at huawei.com
Thu Aug 20 02:43:20 EDT 2020
On 2020/8/20 12:30, Sagi Grimberg wrote:
>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index 74f76aa78b02..f4c347fe925a 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -1422,21 +1422,25 @@ EXPORT_SYMBOL_GPL(nvme_set_queue_count);
>> (NVME_AEN_CFG_NS_ATTR | NVME_AEN_CFG_FW_ACT | \
>> NVME_AEN_CFG_ANA_CHANGE | NVME_AEN_CFG_DISC_CHANGE)
>> -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.
More information about the Linux-nvme
mailing list