Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue might not be rewinded correctly in qdma_queue_add in case buffer too short #17

Closed
hmaarrfk opened this issue May 15, 2019 · 2 comments

Comments

@hmaarrfk
Copy link

In the snippet below, an error message is passed to the user.
However, if they provide a buffer that is too small, the queue doesn't get rewound correctly.

if (buf && buflen) {
cur += snprintf(cur, end - cur,
"qdma%05x no %s QP, %u.\n",
xdev->conf.bdf,
qconf->st ? "ST" : "MM", qdev->qmax);
if (cur >= end)
goto handle_truncation;
}
goto rewind_qcnt;

rewind_qcnt:
spin_lock(&qdev->lock);
if (qconf->c2h)
qdev->c2h_qcnt--;
else
qdev->h2c_qcnt--;
spin_unlock(&qdev->lock);
return rv;
handle_truncation:
*buf = '\0';
return rv;
}

@sujathabanoth-xlnx
Copy link
Collaborator

Issue addressed in 2019.2 driver release, Hence closing it

@hmaarrfk
Copy link
Author

hmm, ok. i'm not too sure it is done correctly even in the new version.

It seems that if the queue is added there may be some cases where the following is not called

			descq->q_state = Q_STATE_DISABLED;

before an error is raised...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants