Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 27c5f04

Browse files
Norbert SlusarekJeevakaPrabu
authored andcommitted
can: bcm: fix infoleak in struct bcm_msg_head
On 64-bit systems, struct bcm_msg_head has an added padding of 4 bytes between struct members count and ival1. Even though all struct members are initialized, the 4-byte hole will contain data from the kernel stack. This patch zeroes out struct bcm_msg_head before usage, preventing infoleaks to userspace. Fixes: ffd980f ("[CAN]: Add broadcast manager (bcm) protocol") Signed-off-by: Norbert Slusarek <nslusarek@gmx.net>
1 parent 6cbc888 commit 27c5f04

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

net/can/bcm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,6 +404,7 @@ static enum hrtimer_restart bcm_tx_timeout_handler(struct hrtimer *hrtimer)
404404
if (!op->count && (op->flags & TX_COUNTEVT)) {
405405

406406
/* create notification to user */
407+
memset(&msg_head, 0, sizeof(msg_head));
407408
msg_head.opcode = TX_EXPIRED;
408409
msg_head.flags = op->flags;
409410
msg_head.count = op->count;
@@ -441,6 +442,7 @@ static void bcm_rx_changed(struct bcm_op *op, struct canfd_frame *data)
441442
/* this element is not throttled anymore */
442443
data->flags &= (BCM_CAN_FLAGS_MASK|RX_RECV);
443444

445+
memset(&head, 0, sizeof(head));
444446
head.opcode = RX_CHANGED;
445447
head.flags = op->flags;
446448
head.count = op->count;
@@ -562,6 +564,7 @@ static enum hrtimer_restart bcm_rx_timeout_handler(struct hrtimer *hrtimer)
562564
}
563565

564566
/* create notification to user */
567+
memset(&msg_head, 0, sizeof(msg_head));
565568
msg_head.opcode = RX_TIMEOUT;
566569
msg_head.flags = op->flags;
567570
msg_head.count = op->count;

0 commit comments

Comments
 (0)