Skip to contentSkip to conversation

vringh: Use wiov->used to check for read/write desc order

PATCH Superseded Neeraj Upadhyay 4 participants 4 messages Jun 22, 2021 – Jun 23, 2021

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 vringh: Use wiov->used to check for read/write desc order

As iov->used is incremented when descriptors are processed in __vringh_iov(), use it to check for incorrect read and write descriptor order.

---
 drivers/vhost/vringh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vringh.c +1 -1
index 4af8fa2..14e2043 100644
@@ -359,7 +359,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
 			iov = wiov;
 		else {
 			iov = riov;
-			if (unlikely(wiov && wiov->i)) {
+			if (unlikely(wiov && wiov->used)) {
 				vringh_bad("Readable desc %p after writable",
 					   &descs[i]);
 				err = -EINVAL;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
hosted by The Linux Foundation
Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Neeraj Upadhyay

As iov->used is incremented when descriptors are processed in __vringh_iov(), use it to check for incorrect read and write descriptor order.

Quoted 17 lines
---
  drivers/vhost/vringh.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vringh.c +1 -1
index 4af8fa2..14e2043 100644
@@ -359,7 +359,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
  			iov = wiov;
  		else {
  			iov = riov;
-			if (unlikely(wiov && wiov->i)) {
+			if (unlikely(wiov && wiov->used)) {
  				vringh_bad("Readable desc %p after writable",
  					   &descs[i]);
  				err = -EINVAL;
Reviewed-by on v1 1/1
#2 lore raw
In reply to Neeraj Upadhyay
Quoted 8 lines · Neeraj Upadhyay

As iov->used is incremented when descriptors are processed in __vringh_iov(), use it to check for incorrect read and write descriptor order.

---
drivers/vhost/vringh.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 18 lines
drivers/vhost/vringh.c +1 -1
index 4af8fa2..14e2043 100644
@@ -359,7 +359,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
 			iov = wiov;
 		else {
 			iov = riov;
-			if (unlikely(wiov && wiov->i)) {
+			if (unlikely(wiov && wiov->used)) {
 				vringh_bad("Readable desc %p after writable",
 					   &descs[i]);
 				err = -EINVAL;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#3 lore raw
In reply to Neeraj Upadhyay
Quoted 3 lines · Neeraj Upadhyay

As iov->used is incremented when descriptors are processed in __vringh_iov(), use it to check for incorrect read and write descriptor order.

Could the commit log be clearer? why is wiov->i incorrect here?

Quoted 21 lines
---
 drivers/vhost/vringh.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/vhost/vringh.c +1 -1
index 4af8fa2..14e2043 100644
@@ -359,7 +359,7 @@ __vringh_iov(struct vringh *vrh, u16 i,
 			iov = wiov;
 		else {
 			iov = riov;
-			if (unlikely(wiov && wiov->i)) {
+			if (unlikely(wiov && wiov->used)) {
 				vringh_bad("Readable desc %p after writable",
 					   &descs[i]);
 				err = -EINVAL;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, 
hosted by The Linux Foundation