Re: [PATCH v2 for-rc] RDMA/srpt: Fix UAF when srpt_add_one() failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 8/1/24 5:32 AM, Junxian Huang wrote:
Besides, exchange the order of INIT_WORK() and srpt_refresh_port()
in srpt_add_one(), so that when srpt_refresh_port() failed, there
is no need to cancel the work in this iteration.

The above description is wrong. There is no need to cancel work after
INIT_WORK() has been called if the work has never been queued. Hence,
moving the INIT_WORK() call is not necessary.

@@ -3220,7 +3221,6 @@ static int srpt_add_one(struct ib_device *device)
  		sport->port_attrib.srp_max_rsp_size = DEFAULT_MAX_RSP_SIZE;
  		sport->port_attrib.srp_sq_size = DEF_SRPT_SQ_SIZE;
  		sport->port_attrib.use_srq = false;
-		INIT_WORK(&sport->work, srpt_refresh_port_work);
ret = srpt_refresh_port(sport);
  		if (ret) {
@@ -3229,6 +3229,8 @@ static int srpt_add_one(struct ib_device *device)
  			i--;
  			goto err_port;
  		}
+
+		INIT_WORK(&sport->work, srpt_refresh_port_work);
  	}

I don't think that this change is necessary.

Bart.





[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux