net: rmnet_data: new structure for rmnet ioctls
This patch modifies the rmnet ioctls RMNET_IOCTL_GET_LLP, RMNET_IOCTL_GET_QOS, RMNET_IOCTL_GET_OPMODE, RMNET_IOCTL_FLOW_ENABLE and RMNET_IOCTL_FLOW_DISABLE to avoid putting integral data in pointers and avoid casting between 32 and 64 bits types. CRs-Fixed: 601207 Change-Id: I66edb785f6204f38b6f0ecccb2ceab36d5e38188 Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com> Signed-off-by: Harout Hedeshian <harouth@codeaurora.org> [subashab@codeaurora.org: remove driver specific changes] Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
This commit is contained in:
parent
a207285d7f
commit
3988539fdd
2 changed files with 30 additions and 5 deletions
|
@ -118,6 +118,13 @@ struct rmnet_ioctl_extended_s {
|
|||
} u;
|
||||
};
|
||||
|
||||
struct rmnet_ioctl_data_s {
|
||||
union {
|
||||
uint32_t operation_mode;
|
||||
uint32_t tcm_handle;
|
||||
} u;
|
||||
};
|
||||
|
||||
#define RMNET_IOCTL_QOS_MODE_6 (1<<0)
|
||||
#define RMNET_IOCTL_QOS_MODE_8 (1<<1)
|
||||
|
||||
|
|
|
@ -212,6 +212,7 @@ static int _rmnet_vnd_do_qos_ioctl(struct net_device *dev,
|
|||
{
|
||||
struct rmnet_vnd_private_s *dev_conf;
|
||||
int rc;
|
||||
struct rmnet_ioctl_data_s ioctl_data;
|
||||
rc = 0;
|
||||
dev_conf = (struct rmnet_vnd_private_s *) netdev_priv(dev);
|
||||
|
||||
|
@ -230,18 +231,31 @@ static int _rmnet_vnd_do_qos_ioctl(struct net_device *dev,
|
|||
|
||||
case RMNET_IOCTL_GET_QOS: /* Get QoS header state */
|
||||
LOGM("RMNET_IOCTL_GET_QOS on %s", dev->name);
|
||||
ifr->ifr_ifru.ifru_data =
|
||||
(void *)(dev_conf->qos_version == RMNET_IOCTL_QOS_MODE_6);
|
||||
ioctl_data.u.operation_mode = (dev_conf->qos_version ==
|
||||
RMNET_IOCTL_QOS_MODE_6);
|
||||
if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
|
||||
sizeof(struct rmnet_ioctl_data_s)))
|
||||
rc = -EFAULT;
|
||||
break;
|
||||
|
||||
case RMNET_IOCTL_FLOW_ENABLE:
|
||||
LOGL("RMNET_IOCTL_FLOW_ENABLE on %s", dev->name);
|
||||
tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 1);
|
||||
if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
|
||||
sizeof(struct rmnet_ioctl_data_s))) {
|
||||
rc = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 1);
|
||||
break;
|
||||
|
||||
case RMNET_IOCTL_FLOW_DISABLE:
|
||||
LOGL("RMNET_IOCTL_FLOW_DISABLE on %s", dev->name);
|
||||
tc_qdisc_flow_control(dev, (u32)ifr->ifr_data, 0);
|
||||
if (copy_from_user(&ioctl_data, ifr->ifr_ifru.ifru_data,
|
||||
sizeof(struct rmnet_ioctl_data_s))) {
|
||||
rc = -EFAULT;
|
||||
break;
|
||||
}
|
||||
tc_qdisc_flow_control(dev, ioctl_data.u.tcm_handle, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -387,6 +401,7 @@ static int rmnet_vnd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
{
|
||||
struct rmnet_vnd_private_s *dev_conf;
|
||||
int rc;
|
||||
struct rmnet_ioctl_data_s ioctl_data;
|
||||
rc = 0;
|
||||
dev_conf = (struct rmnet_vnd_private_s *) netdev_priv(dev);
|
||||
|
||||
|
@ -417,7 +432,10 @@ static int rmnet_vnd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
|
|||
|
||||
case RMNET_IOCTL_GET_LLP: /* Always return IP mode */
|
||||
LOGM("RMNET_IOCTL_GET_LLP on %s", dev->name);
|
||||
ifr->ifr_ifru.ifru_data = (void *)(RMNET_MODE_LLP_IP);
|
||||
ioctl_data.u.operation_mode = RMNET_MODE_LLP_IP;
|
||||
if (copy_to_user(ifr->ifr_ifru.ifru_data, &ioctl_data,
|
||||
sizeof(struct rmnet_ioctl_data_s)))
|
||||
rc = -EFAULT;
|
||||
break;
|
||||
|
||||
case RMNET_IOCTL_EXTENDED:
|
||||
|
|
Loading…
Add table
Reference in a new issue