mirror of
https://github.com/torvalds/linux.git
synced 2026-09-24 06:24:02 +02:00
misc: ibmvmc: release send buffer on write errors
ibmvmc_get_valid_hmc_buffer() marks the selected send buffer busy before ibmvmc_write() validates the backing storage or copies data from user space. Error exits after that point leave the buffer permanently busy. Keep the buffer pointer until ownership is handed to the hypervisor, and mark it free again on local write failures. Also report an RDMA send failure instead of returning a successful byte count. Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com> Link: https://patch.msgid.link/20260624185925.2133-1-alhouseenyousef@gmail.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
7bf6940d7c
commit
fd62c1f591
|
|
@ -1040,7 +1040,7 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer,
|
|||
size_t count, loff_t *ppos)
|
||||
{
|
||||
struct inode *inode;
|
||||
struct ibmvmc_buffer *vmc_buffer;
|
||||
struct ibmvmc_buffer *vmc_buffer = NULL;
|
||||
struct ibmvmc_file_session *session;
|
||||
struct crq_server_adapter *adapter;
|
||||
struct ibmvmc_hmc *hmc;
|
||||
|
|
@ -1130,9 +1130,15 @@ static ssize_t ibmvmc_write(struct file *file, const char *buffer,
|
|||
dev_dbg(adapter->dev, "write: file = 0x%lx, count = 0x%lx\n",
|
||||
(unsigned long)file, (unsigned long)count);
|
||||
|
||||
ibmvmc_send_msg(adapter, vmc_buffer, hmc, count);
|
||||
if (ibmvmc_send_msg(adapter, vmc_buffer, hmc, count)) {
|
||||
ret = -EIO;
|
||||
goto out;
|
||||
}
|
||||
vmc_buffer = NULL;
|
||||
ret = p - buffer;
|
||||
out:
|
||||
if (vmc_buffer)
|
||||
vmc_buffer->free = 1;
|
||||
spin_unlock_irqrestore(&hmc->lock, flags);
|
||||
return (ssize_t)(ret);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user