lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1315223145-20640-42-git-send-email-philipp.reisner@linbit.com>
Date:	Mon,  5 Sep 2011 13:45:32 +0200
From:	Philipp Reisner <philipp.reisner@...bit.com>
To:	linux-kernel@...r.kernel.org, Jens Axboe <axboe@...nel.dk>
Cc:	drbd-dev@...ts.linbit.com
Subject: [PATCH 41/54] drbd: recv_dless_read(): Return 0 upon success and an error code otherwise

From: Andreas Gruenbacher <agruen@...bit.com>

Signed-off-by: Philipp Reisner <philipp.reisner@...bit.com>
Signed-off-by: Lars Ellenberg <lars.ellenberg@...bit.com>
---
 drivers/block/drbd/drbd_receiver.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index ceced15..6e5ffeb 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1429,7 +1429,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
 				dev_warn(DEV,
 					"short read receiving data reply digest: read %d expected %d\n",
 					rr, dgs);
-			return 0;
+			return rr < 0 ? rr : -EIO;
 		}
 	}
 
@@ -1453,7 +1453,7 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
 				dev_warn(DEV, "short read receiving data reply: "
 					"read %d expected %d\n",
 					rr, expect);
-			return 0;
+			return rr < 0 ? rr : -EIO;
 		}
 		data_size -= rr;
 	}
@@ -1462,12 +1462,12 @@ static int recv_dless_read(struct drbd_conf *mdev, struct drbd_request *req,
 		drbd_csum_bio(mdev, mdev->tconn->integrity_r_tfm, bio, dig_vv);
 		if (memcmp(dig_in, dig_vv, dgs)) {
 			dev_err(DEV, "Digest integrity check FAILED. Broken NICs?\n");
-			return 0;
+			return -EINVAL;
 		}
 	}
 
 	D_ASSERT(data_size == 0);
-	return 1;
+	return 0;
 }
 
 /* e_end_resync_block() is called via
@@ -1568,7 +1568,7 @@ static int receive_DataReply(struct drbd_conf *mdev, enum drbd_packet cmd,
 	/* hlist_del(&req->collision) is done in _req_may_be_done, to avoid
 	 * special casing it there for the various failure cases.
 	 * still no race with drbd_fail_pending_reads */
-	ok = recv_dless_read(mdev, req, sector, data_size);
+	ok = !recv_dless_read(mdev, req, sector, data_size);
 
 	if (ok)
 		req_mod(req, DATA_RECEIVED);
-- 
1.7.4.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ