[PATCH v2 3/5] nvme-fabrics: introduce ref counting for nvmf_ctrl_options

Hannes Reinecke hare at suse.de
Wed Feb 21 07:54:48 PST 2024


On 2/21/24 14:24, Daniel Wagner wrote:
> The FC transport is offloading the connect attempt to a workqueue. When
> the attempt fails the transport is starting to cleanup resources. It is
> possible for user space to trigger a crash because nvmf_ctrl_options are
> exposed to sysfs.
> 
> This crash wasn't observed with blktests nvme/041 until now because the
> retry loop was usually trying for several times (e.g. with defaults
> 600s) and the test would trigger the cleanup itself. Though we the
> recent change not retrying to use invalid credentials the crash can be
> easily triggered.
> 
> The simplest way to control the life time of nvmf_ctrl_options is by
> using ref counting.
> 
> Signed-off-by: Daniel Wagner <dwagner at suse.de>
> ---
>   drivers/nvme/host/fabrics.c | 22 +++++++++++++++++++---
>   drivers/nvme/host/fabrics.h |  6 +++++-
>   drivers/nvme/host/fc.c      | 14 +++++++++-----
>   drivers/nvme/host/rdma.c    | 18 +++++++++++++-----
>   drivers/nvme/host/tcp.c     | 21 ++++++++++++++-------
>   drivers/nvme/target/loop.c  | 19 +++++++++++++------
>   6 files changed, 73 insertions(+), 27 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare at suse.de>

Cheers,

Hannes

-- 
Dr. Hannes Reinecke                  Kernel Storage Architect
hare at suse.de                                +49 911 74053 688
SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg
HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich




More information about the Linux-nvme mailing list