diff mbox series

drbd: swap bvec_set_page len and offset

Message ID 20230906133034.948817-1-christoph.boehmwalder@linbit.com (mailing list archive)
State New, archived
Headers show
Series drbd: swap bvec_set_page len and offset | expand

Commit Message

Christoph Böhmwalder Sept. 6, 2023, 1:30 p.m. UTC
bvec_set_page has the following signature:

static inline void bvec_set_page(struct bio_vec *bv, struct page *page,
		unsigned int len, unsigned int offset)

However, the usage in DRBD swaps the len and offset parameters. This
leads to a bvec with length=0 instead of the intended length=4096, which
causes sock_sendmsg to return -EIO.

This leaves DRBD unable to transmit any pages and thus completely
broken.

Swapping the parameters fixes the regression.

Fixes: eeac7405c735 ("drbd: Use sendmsg(MSG_SPLICE_PAGES) rather than sendpage()")
Reported-by: Serguei Ivantsov <manowar@gsc-game.com>
Link: https://lore.kernel.org/regressions/CAKH+VT3YLmAn0Y8=q37UTDShqxDLsqPcQ4hBMzY7HPn7zNx+RQ@mail.gmail.com/
Cc: stable@vger.kernel.org
Signed-off-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
---
 drivers/block/drbd/drbd_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Sept. 6, 2023, 1:33 p.m. UTC | #1
On Wed, 06 Sep 2023 15:30:34 +0200, Christoph Böhmwalder wrote:
> bvec_set_page has the following signature:
> 
> static inline void bvec_set_page(struct bio_vec *bv, struct page *page,
> 		unsigned int len, unsigned int offset)
> 
> However, the usage in DRBD swaps the len and offset parameters. This
> leads to a bvec with length=0 instead of the intended length=4096, which
> causes sock_sendmsg to return -EIO.
> 
> [...]

Applied, thanks!

[1/1] drbd: swap bvec_set_page len and offset
      commit: 4b9c2edaf7282d60e069551b4b28abc2932cd3e3

Best regards,
diff mbox series

Patch

diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c
index 79ab532aabaf..6bc86106c7b2 100644
--- a/drivers/block/drbd/drbd_main.c
+++ b/drivers/block/drbd/drbd_main.c
@@ -1557,7 +1557,7 @@  static int _drbd_send_page(struct drbd_peer_device *peer_device, struct page *pa
 	do {
 		int sent;
 
-		bvec_set_page(&bvec, page, offset, len);
+		bvec_set_page(&bvec, page, len, offset);
 		iov_iter_bvec(&msg.msg_iter, ITER_SOURCE, &bvec, 1, len);
 
 		sent = sock_sendmsg(socket, &msg);