Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cb64f1e1 authored by Kaustubh Pandey's avatar Kaustubh Pandey Committed by Gerrit - the friendly Code Review server
Browse files

net: memset smsg to avoid the padding data



memset smsg to avoid the padding data of kernel to be shared
with user space. Fix is to set fields event to all "0", but there is
actually 6 bytes padding between "sktype" and "skflags", so memset was
done to set all the padding bits to 0.

CRs-Fixed: 2287852

Change-Id: I435486b80ad19c5fa54b098680623e7a4f080198
Signed-off-by: default avatarKaustubh Pandey <kapandey@codeaurora.org>
Acked-by: default avatarChinmay Agarwal <chinagar@qti.qualcomm.com>
parent 36738f59
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -36,7 +36,6 @@ static struct netlink_kernel_cfg nlcfg = {

static void _sockev_event(unsigned long event, __u8 *evstr, int buflen)
{
	memset(evstr, 0, buflen);

	switch (event) {
	case SOCKEV_SOCKET:
@@ -98,6 +97,9 @@ static int sockev_client_cb(struct notifier_block *nb,
	NETLINK_CB(skb).dst_group = SKNLGRP_SOCKEV;

	smsg = nlmsg_data(nlh);

	memset(smsg, 0, sizeof(struct sknlsockevmsg));

	smsg->pid = current->pid;
	_sockev_event(event, smsg->event, sizeof(smsg->event));
	smsg->skfamily = sk->sk_family;