Skip to contentSkip to conversation

IB/rxe: Fix resid update

PATCH Applied Dan Carpenter 3 participants 6 messages Feb 7, 2017 – Feb 8, 2017 2 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 8892e1d1-84ba-489b-d118-3599b9b50b0f-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH 1/2 IB/rxe: Fix resid update

From: Eyal Itkin <[email protected]>

Update the response's resid field when larger than MTU, instead of only updating the local resid variable.

Fixes 8700e3e7c485 ("Soft RoCE driver")
drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
index 7bf20ced2078..d404a8aba7af 100644
@@ -479,7 +479,7 @@ static enum resp_states check_rkey(struct rxe_qp *qp,
 				goto err;
 			}
 
-			resid = mtu;
+			qp->resp.resid = mtu;
 		} else {
 			if (pktlen != resid) {
 				state = RESPST_ERR_LENGTH;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Applied
#4 lore raw
In reply to Dan Carpenter
Quoted 22 lines · Dan Carpenter

From: Eyal Itkin <[email protected]>

Update the response's resid field when larger than MTU, instead of only
updating the local resid variable.

Fixes 8700e3e7c485 ("Soft RoCE driver")
drivers/infiniband/sw/rxe/rxe_resp.c +0 -0
index 7bf20ced2078..d404a8aba7af 100644
@@ -479,7 +479,7 @@ static enum resp_states check_rkey(struct rxe_qp
 *qp,
  				goto err;
  			}

drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
-			resid = mtu;
+			qp->resp.resid = mtu;
Quoted 3 lines

  } else {
  if (pktlen != resid) { state = RESPST_ERR_LENGTH;

Applied, thanks.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD
#5 lore raw

PATCH v2 2/2 IB/rxe: Fix mem_check_range integer overflow

In reply to a message not in the archive

From: Eyal Itkin <[email protected]>

Update the range check to avoid integer-overflow in edge case. Resolves CVE 2016-8636.

---
v2: I completely misread Eyal's first patch.

drivers/infiniband/sw/rxe/rxe_mr.c +5 -3
index 8cf38b253c37..37eea7441ca4 100644
@@ -59,9 +59,11 @@ int mem_check_range(struct rxe_mem *mem, u64 iova, size_t length)
 
 	case RXE_MEM_TYPE_MR:
 	case RXE_MEM_TYPE_FMR:
-		return ((iova < mem->iova) ||
-			((iova + length) > (mem->iova + mem->length))) ?
-			-EFAULT : 0;
+		if (iova < mem->iova ||
+		    length > mem->length ||
+		    iova > mem->iova + mem->length - length)
+			return -EFAULT;
+		return 0;
 
 	default:
 		return -EFAULT;

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

Reviewed-by on v2 2/2
#6 lore raw

Re: [patch 2/2 v2] IB/rxe: Fix mem_check_range integer overflow

Quoted 10 lines · Dan Carpenter

From: Eyal Itkin <[email protected]>

Update the range check to avoid integer-overflow in edge case. Resolves CVE 2016-8636.

---
v2: I completely misread Eyal's first patch.

Thanks,

Applied
#7 lore raw

Re: [patch 2/2 v2] IB/rxe: Fix mem_check_range integer overflow

In reply to Dan Carpenter
Quoted 29 lines · Dan Carpenter

From: Eyal Itkin <[email protected]>

Update the range check to avoid integer-overflow in edge case. Resolves CVE 2016-8636.

---
v2: I completely misread Eyal's first patch.

drivers/infiniband/sw/rxe/rxe_mr.c +0 -0
index 8cf38b253c37..37eea7441ca4 100644
@@ -59,9 +59,11 @@ int mem_check_range(struct rxe_mem *mem, u64 iova,
 size_t length)


  case RXE_MEM_TYPE_MR:
  case RXE_MEM_TYPE_FMR:

drivers/infiniband/sw/rxe/rxe_mr.c +0 -2
-		return ((iova < mem->iova) ||
-			((iova + length) > (mem->iova + mem-
Quoted 1 line

length))) ?

drivers/infiniband/sw/rxe/rxe_mr.c +5 -1
-			-EFAULT : 0;
+		if (iova < mem->iova ||
+		    length > mem->length ||
+		    iova > mem->iova + mem->length - length)
+			return -EFAULT;
+		return 0;
Quoted 3 lines


  default:
  return -EFAULT;

Thanks, applied.

Signature · 4 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD