aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2014-06-25 11:52:38 -0400
committerJens Axboe <axboe@fb.com>2014-06-25 11:53:47 -0400
commit54ed4ed8f9a5071a3bbae2e037376d8c02b9629b (patch)
tree8af1eb069624fa2aa4ab8a27b7eb39429b2998c0
parent0ffbce80c263821161190f20e74a12f7aa8eab7b (diff)
drbd: fix NULL pointer deref in blk_add_request_payload
Discards don't have any payload. But the scsi layer still expects a bio_vec it can use internally, see sd_setup_discard_cmnd() and blk_add_request_payload(). Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com> Signed-off-by: Jens Axboe <axboe@fb.com>
-rw-r--r--drivers/block/drbd/drbd_receiver.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c
index b6c8aaf4931b..5b17ec88ea05 100644
--- a/drivers/block/drbd/drbd_receiver.c
+++ b/drivers/block/drbd/drbd_receiver.c
@@ -1337,8 +1337,11 @@ int drbd_submit_peer_request(struct drbd_device *device,
1337 return 0; 1337 return 0;
1338 } 1338 }
1339 1339
1340 /* Discards don't have any payload.
1341 * But the scsi layer still expects a bio_vec it can use internally,
1342 * see sd_setup_discard_cmnd() and blk_add_request_payload(). */
1340 if (peer_req->flags & EE_IS_TRIM) 1343 if (peer_req->flags & EE_IS_TRIM)
1341 nr_pages = 0; /* discards don't have any payload. */ 1344 nr_pages = 1;
1342 1345
1343 /* In most cases, we will only need one bio. But in case the lower 1346 /* In most cases, we will only need one bio. But in case the lower
1344 * level restrictions happen to be different at this offset on this 1347 * level restrictions happen to be different at this offset on this