Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 85e6a6ad authored by James Smart's avatar James Smart Committed by Jens Axboe
Browse files

nvme-fc: require target or discovery role for fc-nvme targets



In order to create an association, the remoteport must be
serving either a target role or a discovery role.

Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarJohannes Thumshirn <jthumshirn@suse.de>
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJens Axboe <axboe@fb.com>
parent 41231090
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -2720,6 +2720,12 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
	unsigned long flags;
	unsigned long flags;
	int ret, idx;
	int ret, idx;


	if (!(rport->remoteport.port_role &
	    (FC_PORT_ROLE_NVME_DISCOVERY | FC_PORT_ROLE_NVME_TARGET))) {
		ret = -EBADR;
		goto out_fail;
	}

	ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
	ctrl = kzalloc(sizeof(*ctrl), GFP_KERNEL);
	if (!ctrl) {
	if (!ctrl) {
		ret = -ENOMEM;
		ret = -ENOMEM;