aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ellenberg <lars.ellenberg@linbit.com>2010-11-24 04:41:45 -0500
committerPhilipp Reisner <philipp.reisner@linbit.com>2011-03-10 05:35:14 -0500
commit3e3a7766c2e6995ac98e7855017abc3544d54e08 (patch)
tree943c9d62c89764f1070a8a4067a3bd0d4e9de162
parent17a93f3007c13003c739a19d0814cb5c2d21daba (diff)
drbd: use kzalloc and memset(,0,) to start with clean buffers in drbd_nl
Make sure we start with clean buffers to not accidentally send garbage back to userspace. Note: has not been observed; but just in case. Signed-off-by: Philipp Reisner <philipp.reisner@linbit.com> Signed-off-by: Lars Ellenberg <lars.ellenberg@linbit.com>
-rw-r--r--drivers/block/drbd/drbd_nl.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index f969d8717e2..80a389d24cd 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -2211,7 +2211,7 @@ static void drbd_connector_callback(struct cn_msg *req, struct netlink_skb_parms
2211 reply_size += cm->reply_body_size; 2211 reply_size += cm->reply_body_size;
2212 2212
2213 /* allocation not in the IO path, cqueue thread context */ 2213 /* allocation not in the IO path, cqueue thread context */
2214 cn_reply = kmalloc(reply_size, GFP_KERNEL); 2214 cn_reply = kzalloc(reply_size, GFP_KERNEL);
2215 if (!cn_reply) { 2215 if (!cn_reply) {
2216 retcode = ERR_NOMEM; 2216 retcode = ERR_NOMEM;
2217 goto fail; 2217 goto fail;
@@ -2382,7 +2382,7 @@ void drbd_bcast_ee(struct drbd_conf *mdev,
2382 /* receiver thread context, which is not in the writeout path (of this node), 2382 /* receiver thread context, which is not in the writeout path (of this node),
2383 * but may be in the writeout path of the _other_ node. 2383 * but may be in the writeout path of the _other_ node.
2384 * GFP_NOIO to avoid potential "distributed deadlock". */ 2384 * GFP_NOIO to avoid potential "distributed deadlock". */
2385 cn_reply = kmalloc( 2385 cn_reply = kzalloc(
2386 sizeof(struct cn_msg)+ 2386 sizeof(struct cn_msg)+
2387 sizeof(struct drbd_nl_cfg_reply)+ 2387 sizeof(struct drbd_nl_cfg_reply)+
2388 sizeof(struct dump_ee_tag_len_struct)+ 2388 sizeof(struct dump_ee_tag_len_struct)+
@@ -2517,6 +2517,7 @@ void drbd_nl_send_reply(struct cn_msg *req, int ret_code)
2517 (struct drbd_nl_cfg_reply *)cn_reply->data; 2517 (struct drbd_nl_cfg_reply *)cn_reply->data;
2518 int rr; 2518 int rr;
2519 2519
2520 memset(buffer, 0, sizeof(buffer));
2520 cn_reply->id = req->id; 2521 cn_reply->id = req->id;
2521 2522
2522 cn_reply->seq = req->seq; 2523 cn_reply->seq = req->seq;