Re: [PATCH v7 10/12] sunrpc: add dst_attr attributes to the sysfs xprt directory

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

 



On Fri, May 14, 2021 at 10:13:21AM -0400, Olga Kornievskaia wrote:
> From: Olga Kornievskaia <kolga@xxxxxxxxxx>
> 
> Allow to query and set the destination's address of a transport.
> Setting of the destination address is allowed only for TCP or RDMA
> based connections.
> 
> Signed-off-by: Olga Kornievskaia <kolga@xxxxxxxxxx>
..
> +	saddr = (struct sockaddr *)&xprt->addr;
> +	port = rpc_get_port(saddr);
> +
> +	dst_addr = kstrndup(buf, count - 1, GFP_KERNEL);
> +	if (!dst_addr)
> +		goto out_err;
> +	saved_addr = kzalloc(sizeof(*saved_addr), GFP_KERNEL);
> +	if (!saved_addr)
> +		goto out_err_free;
> +	saved_addr->addr =
> +		rcu_dereference_raw(xprt->address_strings[RPC_DISPLAY_ADDR]);
> +	rcu_assign_pointer(xprt->address_strings[RPC_DISPLAY_ADDR], dst_addr);
> +	call_rcu(&saved_addr->rcu, free_xprt_addr);
> +	xprt->addrlen = rpc_pton(xprt->xprt_net, buf, count - 1, saddr,
> +				 sizeof(*saddr));

Hi Olga,

How does this behave if rpc_pton fails? Perhaps this conversion being
also a validation check on input given from user-space should be done
before the xprt is being modified?

-- 
Dan Aloni



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux