Datasets:
cve_id
stringlengths 13
16
| repo
stringclasses 12
values | repo_url
stringclasses 10
values | file_path
stringlengths 7
62
| function_name
stringlengths 4
52
| pa
stringlengths 50
341k
| pb
stringlengths 33
341k
| px
stringlengths 50
338k
| py
stringlengths 33
338k
| pa_sliced
stringlengths 31
44.3k
| pb_sliced
stringlengths 31
44.6k
| px_sliced
stringlengths 51
45.8k
| py_sliced
stringlengths 33
46.9k
| patch_sliced
stringlengths 0
46.8k
|
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
CVE-2012-2372
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
net/rds/ib_send.c
|
rds_ib_xmit
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
struct rds_ib_connection *ic = conn->c_transport_data;
struct ib_device *dev = ic->i_cm_id->device;
struct rds_ib_send_work *send = NULL;
struct rds_ib_send_work *first;
struct rds_ib_send_work *prev;
struct ib_send_wr *failed_wr;
struct scatterlist *scat;
u32 pos;
u32 i;
u32 work_alloc;
u32 credit_alloc = 0;
u32 posted;
u32 adv_credits = 0;
int send_flags = 0;
int bytes_sent = 0;
int ret;
int flow_controlled = 0;
int nr_sig = 0;
BUG_ON(off % RDS_FRAG_SIZE);
BUG_ON(hdr_off != 0 && hdr_off != sizeof(struct rds_header));
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
scat = &rm->data.op_sg[sg];
ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
return ret;
}
if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) {
i = 1;
} else {
i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
}
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_ring_full);
ret = -ENOMEM;
goto out;
}
if (ic->i_flowctl) {
credit_alloc = rds_ib_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT);
adv_credits += posted;
if (credit_alloc < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc);
work_alloc = credit_alloc;
flow_controlled = 1;
}
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_throttle);
ret = -ENOMEM;
goto out;
}
}
if (!ic->i_data_op) {
if (rm->data.op_nents) {
rm->data.op_count = ib_dma_map_sg(dev, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE);
rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->data.op_count);
if (rm->data.op_count == 0) {
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
ret = -ENOMEM;
goto out;
}
} else {
rm->data.op_count = 0;
}
rds_message_addref(rm);
ic->i_data_op = &rm->data;
if (test_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_ACK_REQUIRED;
}
if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
}
if (rm->rdma.op_active) {
struct rds_ext_header_rdma ext_hdr;
ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.op_rkey);
rds_message_add_extension(&rm->m_inc.i_hdr, RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr));
}
if (rm->m_rdma_cookie) {
rds_message_add_rdma_dest_extension(&rm->m_inc.i_hdr, rds_rdma_cookie_key(rm->m_rdma_cookie), rds_rdma_cookie_offset(rm->m_rdma_cookie));
}
rm->m_inc.i_hdr.h_ack = cpu_to_be64(rds_ib_piggyb_ack(ic));
rds_message_make_checksum(&rm->m_inc.i_hdr);
if (ic->i_flowctl) {
rds_ib_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits);
adv_credits += posted;
BUG_ON(adv_credits > 255);
}
}
if (rm->rdma.op_active && rm->rdma.op_fence) {
send_flags = IB_SEND_FENCE;
}
send = &ic->i_sends[pos];
first = send;
prev = NULL;
scat = &ic->i_data_op->op_sg[sg];
i = 0;
do {
unsigned int len = 0;
send->s_wr.send_flags = send_flags;
send->s_wr.opcode = IB_WR_SEND;
send->s_wr.num_sge = 1;
send->s_wr.next = NULL;
send->s_queued = jiffies;
send->s_op = NULL;
send->s_sge[0].addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
send->s_sge[0].length = sizeof(struct rds_header);
memcpy(&ic->i_send_hdrs[pos], &rm->m_inc.i_hdr, sizeof(struct rds_header));
if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) {
len = min(RDS_FRAG_SIZE, ib_sg_dma_len(dev, scat) - off);
send->s_wr.num_sge = 2;
send->s_sge[1].addr = ib_sg_dma_address(dev, scat) + off;
send->s_sge[1].length = len;
bytes_sent += len;
off += len;
if (off == ib_sg_dma_len(dev, scat)) {
scat++;
off = 0;
}
}
rds_ib_set_wr_signal_state(ic, send, 0);
if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) {
send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED;
}
if (send->s_wr.send_flags & IB_SEND_SIGNALED) {
nr_sig++;
}
rdsdebug("send %p wr %p num_sge %u next %p\n", send, &send->s_wr, send->s_wr.num_sge, send->s_wr.next);
if (ic->i_flowctl && adv_credits) {
struct rds_header *hdr = &ic->i_send_hdrs[pos];
hdr->h_credit = adv_credits;
rds_message_make_checksum(hdr);
adv_credits = 0;
rds_ib_stats_inc(s_ib_tx_credit_updates);
}
if (prev) {
prev->s_wr.next = &send->s_wr;
}
prev = send;
pos = (pos + 1) % ic->i_send_ring.w_nr;
send = &ic->i_sends[pos];
i++;
} while (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]);
if (hdr_off == 0) {
bytes_sent += sizeof(struct rds_header);
}
if (scat == &rm->data.op_sg[rm->data.op_count]) {
prev->s_op = ic->i_data_op;
prev->s_wr.send_flags |= IB_SEND_SOLICITED;
ic->i_data_op = NULL;
}
if (i < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - i);
work_alloc = i;
}
if (ic->i_flowctl && i < credit_alloc) {
rds_ib_send_add_credits(conn, credit_alloc - i);
}
if (nr_sig) {
atomic_add(nr_sig, &ic->i_signaled_sends);
}
failed_wr = &first->s_wr;
ret = ib_post_send(ic->i_cm_id->qp, &first->s_wr, &failed_wr);
rdsdebug("ic %p first %p (wr %p) ret %d wr %p\n", ic, first, &first->s_wr, ret, failed_wr);
BUG_ON(failed_wr != &first->s_wr);
if (ret) {
printk(KERN_WARNG "RDS/IB: ib_post_send to %pI4 " "returned %d\n", &conn->c_faddr, ret);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
rds_ib_sub_signaled(ic, nr_sig);
if (prev->s_op) {
ic->i_data_op = prev->s_op;
prev->s_op = NULL;
}
rds_ib_conn_error(ic->conn, "ib_post_send failed\n");
goto out;
}
ret = bytes_sent;
out:
BUG_ON(adv_credits);
return ret;
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
struct rds_ib_connection *ic = conn->c_transport_data;
struct ib_device *dev = ic->i_cm_id->device;
struct rds_ib_send_work *send = NULL;
struct rds_ib_send_work *first;
struct rds_ib_send_work *prev;
struct ib_send_wr *failed_wr;
struct scatterlist *scat;
u32 pos;
u32 i;
u32 work_alloc;
u32 credit_alloc = 0;
u32 posted;
u32 adv_credits = 0;
int send_flags = 0;
int bytes_sent = 0;
int ret;
int flow_controlled = 0;
int nr_sig = 0;
BUG_ON(off % RDS_FRAG_SIZE);
BUG_ON(hdr_off != 0 && hdr_off != sizeof(struct rds_header));
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
scat = &rm->data.op_sg[sg];
ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
return sizeof(struct rds_header) + ret;
}
if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) {
i = 1;
} else {
i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
}
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_ring_full);
ret = -ENOMEM;
goto out;
}
if (ic->i_flowctl) {
credit_alloc = rds_ib_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT);
adv_credits += posted;
if (credit_alloc < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc);
work_alloc = credit_alloc;
flow_controlled = 1;
}
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_throttle);
ret = -ENOMEM;
goto out;
}
}
if (!ic->i_data_op) {
if (rm->data.op_nents) {
rm->data.op_count = ib_dma_map_sg(dev, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE);
rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->data.op_count);
if (rm->data.op_count == 0) {
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
ret = -ENOMEM;
goto out;
}
} else {
rm->data.op_count = 0;
}
rds_message_addref(rm);
ic->i_data_op = &rm->data;
if (test_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_ACK_REQUIRED;
}
if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
}
if (rm->rdma.op_active) {
struct rds_ext_header_rdma ext_hdr;
ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.op_rkey);
rds_message_add_extension(&rm->m_inc.i_hdr, RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr));
}
if (rm->m_rdma_cookie) {
rds_message_add_rdma_dest_extension(&rm->m_inc.i_hdr, rds_rdma_cookie_key(rm->m_rdma_cookie), rds_rdma_cookie_offset(rm->m_rdma_cookie));
}
rm->m_inc.i_hdr.h_ack = cpu_to_be64(rds_ib_piggyb_ack(ic));
rds_message_make_checksum(&rm->m_inc.i_hdr);
if (ic->i_flowctl) {
rds_ib_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits);
adv_credits += posted;
BUG_ON(adv_credits > 255);
}
}
if (rm->rdma.op_active && rm->rdma.op_fence) {
send_flags = IB_SEND_FENCE;
}
send = &ic->i_sends[pos];
first = send;
prev = NULL;
scat = &ic->i_data_op->op_sg[sg];
i = 0;
do {
unsigned int len = 0;
send->s_wr.send_flags = send_flags;
send->s_wr.opcode = IB_WR_SEND;
send->s_wr.num_sge = 1;
send->s_wr.next = NULL;
send->s_queued = jiffies;
send->s_op = NULL;
send->s_sge[0].addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
send->s_sge[0].length = sizeof(struct rds_header);
memcpy(&ic->i_send_hdrs[pos], &rm->m_inc.i_hdr, sizeof(struct rds_header));
if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) {
len = min(RDS_FRAG_SIZE, ib_sg_dma_len(dev, scat) - off);
send->s_wr.num_sge = 2;
send->s_sge[1].addr = ib_sg_dma_address(dev, scat) + off;
send->s_sge[1].length = len;
bytes_sent += len;
off += len;
if (off == ib_sg_dma_len(dev, scat)) {
scat++;
off = 0;
}
}
rds_ib_set_wr_signal_state(ic, send, 0);
if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) {
send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED;
}
if (send->s_wr.send_flags & IB_SEND_SIGNALED) {
nr_sig++;
}
rdsdebug("send %p wr %p num_sge %u next %p\n", send, &send->s_wr, send->s_wr.num_sge, send->s_wr.next);
if (ic->i_flowctl && adv_credits) {
struct rds_header *hdr = &ic->i_send_hdrs[pos];
hdr->h_credit = adv_credits;
rds_message_make_checksum(hdr);
adv_credits = 0;
rds_ib_stats_inc(s_ib_tx_credit_updates);
}
if (prev) {
prev->s_wr.next = &send->s_wr;
}
prev = send;
pos = (pos + 1) % ic->i_send_ring.w_nr;
send = &ic->i_sends[pos];
i++;
} while (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]);
if (hdr_off == 0) {
bytes_sent += sizeof(struct rds_header);
}
if (scat == &rm->data.op_sg[rm->data.op_count]) {
prev->s_op = ic->i_data_op;
prev->s_wr.send_flags |= IB_SEND_SOLICITED;
ic->i_data_op = NULL;
}
if (i < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - i);
work_alloc = i;
}
if (ic->i_flowctl && i < credit_alloc) {
rds_ib_send_add_credits(conn, credit_alloc - i);
}
if (nr_sig) {
atomic_add(nr_sig, &ic->i_signaled_sends);
}
failed_wr = &first->s_wr;
ret = ib_post_send(ic->i_cm_id->qp, &first->s_wr, &failed_wr);
rdsdebug("ic %p first %p (wr %p) ret %d wr %p\n", ic, first, &first->s_wr, ret, failed_wr);
BUG_ON(failed_wr != &first->s_wr);
if (ret) {
printk(KERN_WARNG "RDS/IB: ib_post_send to %pI4 " "returned %d\n", &conn->c_faddr, ret);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
rds_ib_sub_signaled(ic, nr_sig);
if (prev->s_op) {
ic->i_data_op = prev->s_op;
prev->s_op = NULL;
}
rds_ib_conn_error(ic->conn, "ib_post_send failed\n");
goto out;
}
ret = bytes_sent;
out:
BUG_ON(adv_credits);
return ret;
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
struct rds_ib_connection *ic = conn->c_transport_data;
struct ib_device *dev = ic->i_cm_id->device;
struct rds_ib_send_work *send = NULL;
struct rds_ib_send_work *first;
struct rds_ib_send_work *prev;
struct ib_send_wr *failed_wr;
struct scatterlist *scat;
u32 pos;
u32 i;
u32 work_alloc;
u32 credit_alloc = 0;
u32 posted;
u32 adv_credits = 0;
int send_flags = 0;
int bytes_sent = 0;
int ret;
int flow_controlled = 0;
int nr_sig = 0;
BUG_ON(off % RDS_FRAG_SIZE);
BUG_ON(hdr_off != 0 && hdr_off != sizeof(struct rds_header));
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
scat = &rm->data.op_sg[sg];
ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
return ret;
}
if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) {
i = 1;
} else {
i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
}
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_ring_full);
ret = -ENOMEM;
goto out;
}
if (ic->i_flowctl) {
credit_alloc = rds_ib_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT);
adv_credits += posted;
if (credit_alloc < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc);
work_alloc = credit_alloc;
flow_controlled = 1;
}
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_throttle);
ret = -ENOMEM;
goto out;
}
}
if (!ic->i_data_op) {
if (rm->data.op_nents) {
rm->data.op_count = ib_dma_map_sg(dev, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE);
rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->data.op_count);
if (rm->data.op_count == 0) {
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
ret = -ENOMEM;
goto out;
}
} else {
rm->data.op_count = 0;
}
rds_message_addref(rm);
ic->i_data_op = &rm->data;
if (test_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_ACK_REQUIRED;
}
if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
}
if (rm->rdma.op_active) {
struct rds_ext_header_rdma ext_hdr;
ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.op_rkey);
rds_message_add_extension(&rm->m_inc.i_hdr, RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr));
}
if (rm->m_rdma_cookie) {
rds_message_add_rdma_dest_extension(&rm->m_inc.i_hdr, rds_rdma_cookie_key(rm->m_rdma_cookie), rds_rdma_cookie_offset(rm->m_rdma_cookie));
}
rm->m_inc.i_hdr.h_ack = cpu_to_be64(rds_ib_piggyb_ack(ic));
rds_message_make_checksum(&rm->m_inc.i_hdr);
if (ic->i_flowctl) {
rds_ib_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits);
adv_credits += posted;
BUG_ON(adv_credits > 255);
}
}
if (rm->rdma.op_active && rm->rdma.op_fence) {
send_flags = IB_SEND_FENCE;
}
send = &ic->i_sends[pos];
first = send;
prev = NULL;
scat = &ic->i_data_op->op_sg[sg];
i = 0;
do {
unsigned int len = 0;
send->s_wr.send_flags = send_flags;
send->s_wr.opcode = IB_WR_SEND;
send->s_wr.num_sge = 1;
send->s_wr.next = NULL;
send->s_queued = jiffies;
send->s_op = NULL;
send->s_sge[0].addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
send->s_sge[0].length = sizeof(struct rds_header);
memcpy(&ic->i_send_hdrs[pos], &rm->m_inc.i_hdr, sizeof(struct rds_header));
if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) {
len = min(RDS_FRAG_SIZE, ib_sg_dma_len(dev, scat) - off);
send->s_wr.num_sge = 2;
send->s_sge[1].addr = ib_sg_dma_address(dev, scat) + off;
send->s_sge[1].length = len;
bytes_sent += len;
off += len;
if (off == ib_sg_dma_len(dev, scat)) {
scat++;
off = 0;
}
}
rds_ib_set_wr_signal_state(ic, send, 0);
if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) {
send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED;
}
if (send->s_wr.send_flags & IB_SEND_SIGNALED) {
nr_sig++;
}
rdsdebug("send %p wr %p num_sge %u next %p\n", send, &send->s_wr, send->s_wr.num_sge, send->s_wr.next);
if (ic->i_flowctl && adv_credits) {
struct rds_header *hdr = &ic->i_send_hdrs[pos];
hdr->h_credit = adv_credits;
rds_message_make_checksum(hdr);
adv_credits = 0;
rds_ib_stats_inc(s_ib_tx_credit_updates);
}
if (prev) {
prev->s_wr.next = &send->s_wr;
}
prev = send;
pos = (pos + 1) % ic->i_send_ring.w_nr;
send = &ic->i_sends[pos];
i++;
} while (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]);
if (hdr_off == 0) {
bytes_sent += sizeof(struct rds_header);
}
if (scat == &rm->data.op_sg[rm->data.op_count]) {
prev->s_op = ic->i_data_op;
prev->s_wr.send_flags |= IB_SEND_SOLICITED;
ic->i_data_op = NULL;
}
if (i < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - i);
work_alloc = i;
}
if (ic->i_flowctl && i < credit_alloc) {
rds_ib_send_add_credits(conn, credit_alloc - i);
}
if (nr_sig) {
atomic_add(nr_sig, &ic->i_signaled_sends);
}
failed_wr = &first->s_wr;
ret = ib_post_send(ic->i_cm_id->qp, &first->s_wr, &failed_wr);
rdsdebug("ic %p first %p (wr %p) ret %d wr %p\n", ic, first, &first->s_wr, ret, failed_wr);
BUG_ON(failed_wr != &first->s_wr);
if (ret) {
printk(KERN_WARNG "RDS/IB: ib_post_send to %pI4 " "returned %d\n", &conn->c_faddr, ret);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
rds_ib_sub_signaled(ic, nr_sig);
if (prev->s_op) {
ic->i_data_op = prev->s_op;
prev->s_op = NULL;
}
rds_ib_conn_error(ic->conn, "ib_post_send failed\n");
goto out;
}
ret = bytes_sent;
out:
BUG_ON(adv_credits);
return ret;
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
struct rds_ib_connection *ic = conn->c_transport_data;
struct ib_device *dev = ic->i_cm_id->device;
struct rds_ib_send_work *send = NULL;
struct rds_ib_send_work *first;
struct rds_ib_send_work *prev;
struct ib_send_wr *failed_wr;
struct scatterlist *scat;
u32 pos;
u32 i;
u32 work_alloc;
u32 credit_alloc = 0;
u32 posted;
u32 adv_credits = 0;
int send_flags = 0;
int bytes_sent = 0;
int ret;
int flow_controlled = 0;
int nr_sig = 0;
BUG_ON(off % RDS_FRAG_SIZE);
BUG_ON(hdr_off != 0 && hdr_off != sizeof(struct rds_header));
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
rds_cong_map_updated(conn->c_fcong, ~(u64) 0);
scat = &rm->data.op_sg[sg];
ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
return sizeof(struct rds_header) + ret;
}
if (be32_to_cpu(rm->m_inc.i_hdr.h_len) == 0) {
i = 1;
} else {
i = ceil(be32_to_cpu(rm->m_inc.i_hdr.h_len), RDS_FRAG_SIZE);
}
work_alloc = rds_ib_ring_alloc(&ic->i_send_ring, i, &pos);
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_ring_full);
ret = -ENOMEM;
goto out;
}
if (ic->i_flowctl) {
credit_alloc = rds_ib_send_grab_credits(ic, work_alloc, &posted, 0, RDS_MAX_ADV_CREDIT);
adv_credits += posted;
if (credit_alloc < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - credit_alloc);
work_alloc = credit_alloc;
flow_controlled = 1;
}
if (work_alloc == 0) {
set_bit(RDS_LL_SEND_FULL, &conn->c_flags);
rds_ib_stats_inc(s_ib_tx_throttle);
ret = -ENOMEM;
goto out;
}
}
if (!ic->i_data_op) {
if (rm->data.op_nents) {
rm->data.op_count = ib_dma_map_sg(dev, rm->data.op_sg, rm->data.op_nents, DMA_TO_DEVICE);
rdsdebug("ic %p mapping rm %p: %d\n", ic, rm, rm->data.op_count);
if (rm->data.op_count == 0) {
rds_ib_stats_inc(s_ib_tx_sg_mapping_failure);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
ret = -ENOMEM;
goto out;
}
} else {
rm->data.op_count = 0;
}
rds_message_addref(rm);
ic->i_data_op = &rm->data;
if (test_bit(RDS_MSG_ACK_REQUIRED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_ACK_REQUIRED;
}
if (test_bit(RDS_MSG_RETRANSMITTED, &rm->m_flags)) {
rm->m_inc.i_hdr.h_flags |= RDS_FLAG_RETRANSMITTED;
}
if (rm->rdma.op_active) {
struct rds_ext_header_rdma ext_hdr;
ext_hdr.h_rdma_rkey = cpu_to_be32(rm->rdma.op_rkey);
rds_message_add_extension(&rm->m_inc.i_hdr, RDS_EXTHDR_RDMA, &ext_hdr, sizeof(ext_hdr));
}
if (rm->m_rdma_cookie) {
rds_message_add_rdma_dest_extension(&rm->m_inc.i_hdr, rds_rdma_cookie_key(rm->m_rdma_cookie), rds_rdma_cookie_offset(rm->m_rdma_cookie));
}
rm->m_inc.i_hdr.h_ack = cpu_to_be64(rds_ib_piggyb_ack(ic));
rds_message_make_checksum(&rm->m_inc.i_hdr);
if (ic->i_flowctl) {
rds_ib_send_grab_credits(ic, 0, &posted, 1, RDS_MAX_ADV_CREDIT - adv_credits);
adv_credits += posted;
BUG_ON(adv_credits > 255);
}
}
if (rm->rdma.op_active && rm->rdma.op_fence) {
send_flags = IB_SEND_FENCE;
}
send = &ic->i_sends[pos];
first = send;
prev = NULL;
scat = &ic->i_data_op->op_sg[sg];
i = 0;
do {
unsigned int len = 0;
send->s_wr.send_flags = send_flags;
send->s_wr.opcode = IB_WR_SEND;
send->s_wr.num_sge = 1;
send->s_wr.next = NULL;
send->s_queued = jiffies;
send->s_op = NULL;
send->s_sge[0].addr = ic->i_send_hdrs_dma + (pos * sizeof(struct rds_header));
send->s_sge[0].length = sizeof(struct rds_header);
memcpy(&ic->i_send_hdrs[pos], &rm->m_inc.i_hdr, sizeof(struct rds_header));
if (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]) {
len = min(RDS_FRAG_SIZE, ib_sg_dma_len(dev, scat) - off);
send->s_wr.num_sge = 2;
send->s_sge[1].addr = ib_sg_dma_address(dev, scat) + off;
send->s_sge[1].length = len;
bytes_sent += len;
off += len;
if (off == ib_sg_dma_len(dev, scat)) {
scat++;
off = 0;
}
}
rds_ib_set_wr_signal_state(ic, send, 0);
if (ic->i_flowctl && flow_controlled && i == (work_alloc-1)) {
send->s_wr.send_flags |= IB_SEND_SIGNALED | IB_SEND_SOLICITED;
}
if (send->s_wr.send_flags & IB_SEND_SIGNALED) {
nr_sig++;
}
rdsdebug("send %p wr %p num_sge %u next %p\n", send, &send->s_wr, send->s_wr.num_sge, send->s_wr.next);
if (ic->i_flowctl && adv_credits) {
struct rds_header *hdr = &ic->i_send_hdrs[pos];
hdr->h_credit = adv_credits;
rds_message_make_checksum(hdr);
adv_credits = 0;
rds_ib_stats_inc(s_ib_tx_credit_updates);
}
if (prev) {
prev->s_wr.next = &send->s_wr;
}
prev = send;
pos = (pos + 1) % ic->i_send_ring.w_nr;
send = &ic->i_sends[pos];
i++;
} while (i < work_alloc && scat != &rm->data.op_sg[rm->data.op_count]);
if (hdr_off == 0) {
bytes_sent += sizeof(struct rds_header);
}
if (scat == &rm->data.op_sg[rm->data.op_count]) {
prev->s_op = ic->i_data_op;
prev->s_wr.send_flags |= IB_SEND_SOLICITED;
ic->i_data_op = NULL;
}
if (i < work_alloc) {
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc - i);
work_alloc = i;
}
if (ic->i_flowctl && i < credit_alloc) {
rds_ib_send_add_credits(conn, credit_alloc - i);
}
if (nr_sig) {
atomic_add(nr_sig, &ic->i_signaled_sends);
}
failed_wr = &first->s_wr;
ret = ib_post_send(ic->i_cm_id->qp, &first->s_wr, &failed_wr);
rdsdebug("ic %p first %p (wr %p) ret %d wr %p\n", ic, first, &first->s_wr, ret, failed_wr);
BUG_ON(failed_wr != &first->s_wr);
if (ret) {
printk(KERN_WARNG "RDS/IB: ib_post_send to %pI4 " "returned %d\n", &conn->c_faddr, ret);
rds_ib_ring_unalloc(&ic->i_send_ring, work_alloc);
rds_ib_sub_signaled(ic, nr_sig);
if (prev->s_op) {
ic->i_data_op = prev->s_op;
prev->s_op = NULL;
}
rds_ib_conn_error(ic->conn, "ib_post_send failed\n");
goto out;
}
ret = bytes_sent;
out:
BUG_ON(adv_credits);
return ret;
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
scat = &rm->data.op_sg[sg];
ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
return ret;
}
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
scat = &rm->data.op_sg[sg];
ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
return sizeof(struct rds_header) + ret;
}
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
scat = &rm->data.op_sg[sg];
ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
return ret;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
scat = &rm->data.op_sg[sg];
ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
return sizeof(struct rds_header) + ret;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int rds_ib_xmit(struct rds_connection *conn, struct rds_message *rm, unsigned int hdr_off, unsigned int sg, unsigned int off) {
if (conn->c_loopback && rm->m_inc.i_hdr.h_flags & RDS_FLAG_CONG_BITMAP) {
scat = &rm->data.op_sg[sg];
- ret = sizeof(struct rds_header) + RDS_CONG_MAP_BYTES;
- ret = min_t(int, ret, scat->length - conn->c_xmit_data_off);
- return ret;
+ ret = max_t(int, RDS_CONG_MAP_BYTES, scat->length);
+ return sizeof(struct rds_header) + ret;
}
}
|
CVE-2013-2929
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
kernel/ptrace.c
|
__ptrace_may_access
|
static int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
const struct cred *cred = current_cred(), *tcred;
int dumpable = 0;
if (same_thread_group(task, current)) {
return 0;
}
rcu_read_lock();
tcred = __task_cred(task);
if (uid_eq(cred->uid, tcred->euid) && uid_eq(cred->uid, tcred->suid) && uid_eq(cred->uid, tcred->uid) && gid_eq(cred->gid, tcred->egid) && gid_eq(cred->gid, tcred->sgid)
&& gid_eq(cred->gid, tcred->gid)) {
goto ok;
}
if (ptrace_has_cap(tcred->user_ns, mode)) {
goto ok;
}
rcu_read_unlock();
return -EPERM;
ok:
rcu_read_unlock();
smp_rmb();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
rcu_read_lock();
if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
|
static int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
const struct cred *cred = current_cred(), *tcred;
int dumpable = 0;
if (same_thread_group(task, current)) {
return 0;
}
rcu_read_lock();
tcred = __task_cred(task);
if (uid_eq(cred->uid, tcred->euid) && uid_eq(cred->uid, tcred->suid) && uid_eq(cred->uid, tcred->uid) && gid_eq(cred->gid, tcred->egid) && gid_eq(cred->gid, tcred->sgid)
&& gid_eq(cred->gid, tcred->gid)) {
goto ok;
}
if (ptrace_has_cap(tcred->user_ns, mode)) {
goto ok;
}
rcu_read_unlock();
return -EPERM;
ok:
rcu_read_unlock();
smp_rmb();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
rcu_read_lock();
if (dumpable != SUID_DUMP_USER && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
|
int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
const struct cred *cred = current_cred(), *tcred;
int dumpable = 0;
if (task == current) {
return 0;
}
rcu_read_lock();
tcred = __task_cred(task);
if (cred->user->user_ns == tcred->user->user_ns && (cred->uid == tcred->euid && cred->uid == tcred->suid && cred->uid == tcred->uid && cred->gid == tcred->egid && cred->gid == tcred->sgid
&& cred->gid == tcred->gid)) {
goto ok;
}
if (ns_capable(tcred->user->user_ns, CAP_SYS_PTRACE)) {
goto ok;
}
rcu_read_unlock();
return -EPERM;
ok:
rcu_read_unlock();
smp_rmb();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
if (!dumpable && !task_ns_capable(task, CAP_SYS_PTRACE)) {
return -EPERM;
}
return security_ptrace_access_check(task, mode);
}
|
int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
const struct cred *cred = current_cred(), *tcred;
int dumpable = 0;
if (task == current) {
return 0;
}
rcu_read_lock();
tcred = __task_cred(task);
if (cred->user->user_ns == tcred->user->user_ns && (cred->uid == tcred->euid && cred->uid == tcred->suid && cred->uid == tcred->uid && cred->gid == tcred->egid && cred->gid == tcred->sgid
&& cred->gid == tcred->gid)) {
goto ok;
}
if (ns_capable(tcred->user->user_ns, CAP_SYS_PTRACE)) {
goto ok;
}
rcu_read_unlock();
return -EPERM;
ok:
rcu_read_unlock();
smp_rmb();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
if (dumpable != SUID_DUMP_USER && !task_ns_capable(task, CAP_SYS_PTRACE)) {
return -EPERM;
}
return security_ptrace_access_check(task, mode);
}
|
static int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
int dumpable = 0;
if (same_thread_group(task, current)) {
return 0;
}
tcred = __task_cred(task);
if (ptrace_has_cap(tcred->user_ns, mode)) {
goto ok;
}
ok:
rcu_read_unlock();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
rcu_read_lock();
if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
|
static int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
int dumpable = 0;
if (same_thread_group(task, current)) {
return 0;
}
tcred = __task_cred(task);
if (ptrace_has_cap(tcred->user_ns, mode)) {
goto ok;
}
ok:
rcu_read_unlock();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
rcu_read_lock();
if (dumpable != SUID_DUMP_USER && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
|
int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
int dumpable = 0;
if (task == current) {
return 0;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
tcred = __task_cred(task);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (ns_capable(tcred->user->user_ns, CAP_SYS_PTRACE)) {
goto ok;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
ok:
rcu_read_unlock();
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
if (!dumpable && !task_ns_capable(task, CAP_SYS_PTRACE)) {
return -EPERM;
}
return security_ptrace_access_check(task, mode);
}
|
int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
int dumpable = 0;
if (task == current) {
return 0;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
tcred = __task_cred(task);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (ns_capable(tcred->user->user_ns, CAP_SYS_PTRACE)) {
goto ok;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
ok:
rcu_read_unlock();
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
if (dumpable != SUID_DUMP_USER && !task_ns_capable(task, CAP_SYS_PTRACE)) {
return -EPERM;
}
return security_ptrace_access_check(task, mode);
}
|
static int __ptrace_may_access(struct task_struct *task, unsigned int mode) {
int dumpable = 0;
if (same_thread_group(task, current)) {
return 0;
}
tcred = __task_cred(task);
if (ptrace_has_cap(tcred->user_ns, mode)) {
goto ok;
}
ok:
rcu_read_unlock();
if (task->mm) {
dumpable = get_dumpable(task->mm);
}
rcu_read_lock();
- if (!dumpable && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
+ if (dumpable != SUID_DUMP_USER && !ptrace_has_cap(__task_cred(task)->user_ns, mode)) {
rcu_read_unlock();
return -EPERM;
}
rcu_read_unlock();
return security_ptrace_access_check(task, mode);
}
|
CVE-2013-4312
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
net/unix/af_unix.c
|
unix_attach_fds
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int i;
unsigned char max_level = 0;
int unix_sock_count = 0;
for (i = scm->fp->count - 1; i >= 0; i--) {
struct sock *sk = unix_get_socket(scm->fp->fp[i]);
if (sk) {
unix_sock_count++;
max_level = max(max_level, unix_sk(sk)->recursion_level);
}
}
if (unlikely(max_level > MAX_RECURSION_LEVEL)) {
return -ETOOMANYREFS;
}
UNIXCB(skb).fp = scm_fp_dup(scm->fp);
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
if (unix_sock_count) {
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
}
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int i;
unsigned char max_level = 0;
int unix_sock_count = 0;
if (too_many_unix_fds(current)) {
return -ETOOMANYREFS;
}
for (i = scm->fp->count - 1; i >= 0; i--) {
struct sock *sk = unix_get_socket(scm->fp->fp[i]);
if (sk) {
unix_sock_count++;
max_level = max(max_level, unix_sk(sk)->recursion_level);
}
}
if (unlikely(max_level > MAX_RECURSION_LEVEL)) {
return -ETOOMANYREFS;
}
UNIXCB(skb).fp = scm_fp_dup(scm->fp);
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int i;
unsigned char max_level = 0;
int unix_sock_count = 0;
for (i = scm->fp->count - 1; i >= 0; i--) {
struct sock *sk = unix_get_socket(scm->fp->fp[i]);
if (sk) {
unix_sock_count++;
max_level = max(max_level, unix_sk(sk)->recursion_level);
}
}
if (unlikely(max_level > MAX_RECURSION_LEVEL)) {
return -ETOOMANYREFS;
}
UNIXCB(skb).fp = scm_fp_dup(scm->fp);
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
if (unix_sock_count) {
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
}
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int i;
unsigned char max_level = 0;
int unix_sock_count = 0;
if (too_many_unix_fds(current)) {
return -ETOOMANYREFS;
}
for (i = scm->fp->count - 1; i >= 0; i--) {
struct sock *sk = unix_get_socket(scm->fp->fp[i]);
if (sk) {
unix_sock_count++;
max_level = max(max_level, unix_sk(sk)->recursion_level);
}
}
if (unlikely(max_level > MAX_RECURSION_LEVEL)) {
return -ETOOMANYREFS;
}
UNIXCB(skb).fp = scm_fp_dup(scm->fp);
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int unix_sock_count = 0;
for (i = scm->fp->count - 1; i >= 0; i--) {
}
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
if (unix_sock_count) {
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
}
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int unix_sock_count = 0;
if (too_many_unix_fds(current)) {
return -ETOOMANYREFS;
}
for (i = scm->fp->count - 1; i >= 0; i--) {
}
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
int unix_sock_count = 0;
for (i = scm->fp->count - 1; i >= 0; i--) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
if (unix_sock_count) {
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
}
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
int unix_sock_count = 0;
if (too_many_unix_fds(current)) {
return -ETOOMANYREFS;
}
for (i = scm->fp->count - 1; i >= 0; i--) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
for (i = scm->fp->count - 1; i >= 0; i--)
unix_inflight(scm->fp->fp[i]);
return max_level;
}
|
static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb) {
int unix_sock_count = 0;
+ if (too_many_unix_fds(current)) {
+ return -ETOOMANYREFS;
+ }
for (i = scm->fp->count - 1; i >= 0; i--) {
}
if (!UNIXCB(skb).fp) {
return -ENOMEM;
}
- if (unix_sock_count) {
- for (i = scm->fp->count - 1; i >= 0; i--)
- unix_inflight(scm->fp->fp[i]);
- }
+ for (i = scm->fp->count - 1; i >= 0; i--)
+ unix_inflight(scm->fp->fp[i]);
return max_level;
}
|
CVE-2013-4312
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
net/unix/garbage.c
|
unix_inflight
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
BUG_ON(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list);
} else {
BUG_ON(list_empty(&u->link));
}
unix_tot_inflight++;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
if (atomic_long_inc_return(&u->inflight) == 1) {
BUG_ON(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list);
} else {
BUG_ON(list_empty(&u->link));
}
unix_tot_inflight++;
}
fp->f_cred->user->unix_inflight++;
spin_unlock(&unix_gc_lock);
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
BUG_ON(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list);
} else {
BUG_ON(list_empty(&u->link));
}
unix_tot_inflight++;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
if (atomic_long_inc_return(&u->inflight) == 1) {
BUG_ON(!list_empty(&u->link));
list_add_tail(&u->link, &gc_inflight_list);
} else {
BUG_ON(list_empty(&u->link));
}
unix_tot_inflight++;
}
fp->f_cred->user->unix_inflight++;
spin_unlock(&unix_gc_lock);
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
} else {
}
unix_tot_inflight++;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
if (atomic_long_inc_return(&u->inflight) == 1) {
} else {
}
unix_tot_inflight++;
}
fp->f_cred->user->unix_inflight++;
spin_unlock(&unix_gc_lock);
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
unix_tot_inflight++;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
if (atomic_long_inc_return(&u->inflight) == 1) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
unix_tot_inflight++;
}
fp->f_cred->user->unix_inflight++;
spin_unlock(&unix_gc_lock);
}
|
void unix_inflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
+ spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
- spin_lock(&unix_gc_lock);
if (atomic_long_inc_return(&u->inflight) == 1) {
} else {
}
unix_tot_inflight++;
- spin_unlock(&unix_gc_lock);
}
+ fp->f_cred->user->unix_inflight++;
+ spin_unlock(&unix_gc_lock);
}
|
CVE-2013-4312
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
net/unix/garbage.c
|
unix_notinflight
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
BUG_ON(list_empty(&u->link));
if (atomic_long_dec_and_test(&u->inflight)) {
list_del_init(&u->link);
}
unix_tot_inflight--;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
BUG_ON(list_empty(&u->link));
if (atomic_long_dec_and_test(&u->inflight)) {
list_del_init(&u->link);
}
unix_tot_inflight--;
}
fp->f_cred->user->unix_inflight--;
spin_unlock(&unix_gc_lock);
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
BUG_ON(list_empty(&u->link));
if (atomic_long_dec_and_test(&u->inflight)) {
list_del_init(&u->link);
}
unix_tot_inflight--;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
BUG_ON(list_empty(&u->link));
if (atomic_long_dec_and_test(&u->inflight)) {
list_del_init(&u->link);
}
unix_tot_inflight--;
}
fp->f_cred->user->unix_inflight--;
spin_unlock(&unix_gc_lock);
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
BUG_ON(list_empty(&u->link));
unix_tot_inflight--;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
BUG_ON(list_empty(&u->link));
unix_tot_inflight--;
}
fp->f_cred->user->unix_inflight--;
spin_unlock(&unix_gc_lock);
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
if (s) {
struct unix_sock *u = unix_sk(s);
spin_lock(&unix_gc_lock);
BUG_ON(list_empty(&u->link));
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
unix_tot_inflight--;
spin_unlock(&unix_gc_lock);
}
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
BUG_ON(list_empty(&u->link));
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
unix_tot_inflight--;
}
fp->f_cred->user->unix_inflight--;
spin_unlock(&unix_gc_lock);
}
|
void unix_notinflight(struct file *fp) {
struct sock *s = unix_get_socket(fp);
+ spin_lock(&unix_gc_lock);
if (s) {
struct unix_sock *u = unix_sk(s);
- spin_lock(&unix_gc_lock);
BUG_ON(list_empty(&u->link));
unix_tot_inflight--;
- spin_unlock(&unix_gc_lock);
}
+ fp->f_cred->user->unix_inflight--;
+ spin_unlock(&unix_gc_lock);
}
|
CVE-2013-4345
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
crypto/ansi_cprng.c
|
get_prng_bytes
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned char *ptr = buf;
unsigned int byte_count = (unsigned int)nbytes;
int err;
spin_lock_bh(&ctx->prng_lock);
err = -EVAL;
if (ctx->flags & PRNG_NEED_RESET) {
goto done;
}
err = -EVAL;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
err = byte_count;
dbgprint(KERN_CRIT "getting %d random bytes for context %p\n", byte_count, ctx);
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
ctx->rand_data_valid++) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
if (byte_count) {
goto remainder;
}
done:
spin_unlock_bh(&ctx->prng_lock);
dbgprint(KERN_CRIT "returning %d from get_prng_bytes in context %p\n", err, ctx);
return err;
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned char *ptr = buf;
unsigned int byte_count = (unsigned int)nbytes;
int err;
spin_lock_bh(&ctx->prng_lock);
err = -EVAL;
if (ctx->flags & PRNG_NEED_RESET) {
goto done;
}
err = -EVAL;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
err = byte_count;
dbgprint(KERN_CRIT "getting %d random bytes for context %p\n", byte_count, ctx);
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
ctx->rand_data_valid++;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
if (byte_count) {
goto remainder;
}
done:
spin_unlock_bh(&ctx->prng_lock);
dbgprint(KERN_CRIT "returning %d from get_prng_bytes in context %p\n", err, ctx);
return err;
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned char *ptr = buf;
unsigned int byte_count = (unsigned int)nbytes;
int err;
spin_lock_bh(&ctx->prng_lock);
err = -EVAL;
if (ctx->flags & PRNG_NEED_RESET) {
goto done;
}
err = -EVAL;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
err = byte_count;
dbgprint(KERN_CRIT "getting %d random bytes for context %p\n", byte_count, ctx);
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
ctx->rand_data_valid++) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
if (byte_count) {
goto remainder;
}
done:
spin_unlock_bh(&ctx->prng_lock);
dbgprint(KERN_CRIT "returning %d from get_prng_bytes in context %p\n", err, ctx);
return err;
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned char *ptr = buf;
unsigned int byte_count = (unsigned int)nbytes;
int err;
spin_lock_bh(&ctx->prng_lock);
err = -EVAL;
if (ctx->flags & PRNG_NEED_RESET) {
goto done;
}
err = -EVAL;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
err = byte_count;
dbgprint(KERN_CRIT "getting %d random bytes for context %p\n", byte_count, ctx);
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
ctx->rand_data_valid++;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
if (byte_count) {
goto remainder;
}
done:
spin_unlock_bh(&ctx->prng_lock);
dbgprint(KERN_CRIT "returning %d from get_prng_bytes in context %p\n", err, ctx);
return err;
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned int byte_count = (unsigned int)nbytes;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
ctx->rand_data_valid++) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
done:
spin_unlock_bh(&ctx->prng_lock);
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned int byte_count = (unsigned int)nbytes;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
ctx->rand_data_valid++;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
done:
spin_unlock_bh(&ctx->prng_lock);
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
unsigned int byte_count = (unsigned int)nbytes;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
ctx->rand_data_valid++) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
done:
spin_unlock_bh(&ctx->prng_lock);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
unsigned int byte_count = (unsigned int)nbytes;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
ctx->rand_data_valid++;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
done:
spin_unlock_bh(&ctx->prng_lock);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
static int get_prng_bytes(char *buf, size_t nbytes, struct prng_context *ctx, int do_cont_test) {
unsigned int byte_count = (unsigned int)nbytes;
if (ctx->flags & PRNG_FIXED_SIZE) {
if (nbytes < DEFAULT_BLK_SZ) {
goto done;
}
byte_count = DEFAULT_BLK_SZ;
}
remainder:
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
memset(buf, 0, nbytes);
err = -EVAL;
goto done;
}
}
if (byte_count < DEFAULT_BLK_SZ) {
empty_rbuf:
- for (; ctx->rand_data_valid < DEFAULT_BLK_SZ;
- ctx->rand_data_valid++) {
+ while (ctx->rand_data_valid < DEFAULT_BLK_SZ) {
*ptr = ctx->rand_data[ctx->rand_data_valid];
ptr++;
byte_count--;
+ ctx->rand_data_valid++;
if (byte_count == 0) {
goto done;
}
}
}
for (; byte_count >= DEFAULT_BLK_SZ; byte_count -= DEFAULT_BLK_SZ) {
if (ctx->rand_data_valid == DEFAULT_BLK_SZ) {
if (_get_more_prng_bytes(ctx, do_cont_test) < 0) {
goto done;
}
}
if (ctx->rand_data_valid > 0) {
goto empty_rbuf;
}
memcpy(ptr, ctx->rand_data, DEFAULT_BLK_SZ);
ctx->rand_data_valid += DEFAULT_BLK_SZ;
ptr += DEFAULT_BLK_SZ;
}
done:
spin_unlock_bh(&ctx->prng_lock);
}
|
CVE-2013-4511
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
arch/um/kernel/exitcode.c
|
exitcode_proc_write
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
+ size_t size;
int tmp;
- if (copy_from_user(buf, buffer, count)) {
+ size = min(count, sizeof(buf));
+ if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
CVE-2013-4512
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
arch/um/kernel/exitcode.c
|
exitcode_proc_write
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
if ((*end != '\0') && !isspace(*end)) {
return -EVAL;
}
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
int tmp;
if (copy_from_user(buf, buffer, count)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
size_t size;
int tmp;
size = min(count, sizeof(buf));
if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
uml_exitcode = tmp;
return count;
}
|
static ssize_t exitcode_proc_write(struct file *file, const char *buffer, size_t count, loff_t *pos) {
char *end, buf[sizeof("nnnnn\0")];
+ size_t size;
int tmp;
- if (copy_from_user(buf, buffer, count)) {
+ size = min(count, sizeof(buf));
+ if (copy_from_user(buf, buffer, size)) {
return -EFAULT;
}
tmp = simple_strtol(buf, &end, 0);
uml_exitcode = tmp;
return count;
}
|
CVE-2013-4514
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
drivers/staging/wlags49_h2/wl_priv.c
|
wvlan_set_station_nickname
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
int ret = 0;
DBG_FUNC("wvlan_set_station_nickname");
DBG_ENTER(DbgInfo);
wl_lock(lp, &flags);
memset(lp->StationName, 0, sizeof(lp->StationName));
memcpy(lp->StationName, extra, wrqu->data.length);
wl_apply(lp);
wl_unlock(lp, &flags);
DBG_LEAVE(DbgInfo);
return ret;
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
size_t len;
int ret = 0;
DBG_FUNC("wvlan_set_station_nickname");
DBG_ENTER(DbgInfo);
wl_lock(lp, &flags);
memset(lp->StationName, 0, sizeof(lp->StationName));
len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
strlcpy(lp->StationName, extra, len);
wl_apply(lp);
wl_unlock(lp, &flags);
DBG_LEAVE(DbgInfo);
return ret;
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
int ret = 0;
DBG_FUNC( "wvlan_set_station_nickname" );
DBG_ENTER( DbgInfo );
wl_lock(lp, &flags);
memset( lp->StationName, 0, sizeof( lp->StationName ));
memcpy( lp->StationName, extra, wrqu->data.length);
wl_apply( lp );
wl_unlock(lp, &flags);
DBG_LEAVE( DbgInfo );
return ret;
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
size_t len;
int ret = 0;
DBG_FUNC( "wvlan_set_station_nickname" );
DBG_ENTER( DbgInfo );
wl_lock(lp, &flags);
memset( lp->StationName, 0, sizeof( lp->StationName ));
len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
strlcpy(lp->StationName, extra, len);
wl_apply( lp );
wl_unlock(lp, &flags);
DBG_LEAVE( DbgInfo );
return ret;
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
int ret = 0;
wl_lock(lp, &flags);
memset(lp->StationName, 0, sizeof(lp->StationName));
memcpy(lp->StationName, extra, wrqu->data.length);
wl_apply(lp);
wl_unlock(lp, &flags);
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
size_t len;
int ret = 0;
wl_lock(lp, &flags);
memset(lp->StationName, 0, sizeof(lp->StationName));
len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
strlcpy(lp->StationName, extra, len);
wl_apply(lp);
wl_unlock(lp, &flags);
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
int ret = 0;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
wl_lock(lp, &flags);
memset( lp->StationName, 0, sizeof( lp->StationName ));
memcpy( lp->StationName, extra, wrqu->data.length);
wl_apply( lp );
wl_unlock(lp, &flags);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
size_t len;
int ret = 0;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
wl_lock(lp, &flags);
memset( lp->StationName, 0, sizeof( lp->StationName ));
len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
strlcpy(lp->StationName, extra, len);
wl_apply( lp );
wl_unlock(lp, &flags);
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int wvlan_set_station_nickname(struct net_device *dev, struct iw_request_info *info, union iwreq_data *wrqu, char *extra) {
struct wl_private *lp = wl_priv(dev);
unsigned long flags;
+ size_t len;
int ret = 0;
wl_lock(lp, &flags);
memset(lp->StationName, 0, sizeof(lp->StationName));
- memcpy(lp->StationName, extra, wrqu->data.length);
+ len = min_t(size_t, wrqu->data.length, sizeof(lp->StationName));
+ strlcpy(lp->StationName, extra, len);
wl_apply(lp);
wl_unlock(lp, &flags);
}
|
CVE-2013-4514
|
linux
|
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux
|
drivers/staging/wlags49_h2/wl_priv.c
|
wvlan_uil_put_info
|
int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) {
int result = 0;
ltv_t *pLtv;
bool_t ltvAllocated = FALSE;
ENCSTRCT sEncryption;
hcf_16 hcfPort = HCF_PORT_0;
DBG_FUNC("wvlan_uil_put_info");
DBG_ENTER(DbgInfo);
if (urq->hcfCtx == &(lp->hcfCtx)) {
if (capable(CAP_NET_ADM)) {
if ((urq->data != NULL) && (urq->len != 0)) {
if (urq->len < (sizeof(hcf_16) * 2)) {
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n");
DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
DBG_LEAVE(DbgInfo);
return result;
}
result = verify_area(VERIFY_READ, urq->data, urq->len);
if (result != 0) {
urq->result = UIL_FAILURE;
DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n");
DBG_LEAVE(DbgInfo);
return result;
}
copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2);
if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) {
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
DBG_LEAVE(DbgInfo);
return result;
}
if (urq->len > sizeof(lp->ltvRecord)) {
pLtv = kmalloc(urq->len, GFP_KERNEL);
if (pLtv != NULL) {
ltvAllocated = TRUE;
} else {
DBG_ERROR(DbgInfo, "Alloc FAILED\n");
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
result = -ENOMEM;
DBG_LEAVE(DbgInfo);
return result;
}
} else {
pLtv = &(lp->ltvRecord);
}
copy_from_user(pLtv, urq->data, urq->len);
switch (pLtv->typ) {
case CFG_CNF_PORT_TYPE:
lp->PortType = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_MAC_ADDR:
break;
case CFG_CNF_OWN_CHANNEL:
lp->Channel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_ATIM_WDOW:
lp->atimWindow = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_SYSTEM_SCALE:
lp->DistanceBetweenAPs = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
case CFG_CNF_MAX_DATA_LEN:
break;
case CFG_CNF_PM_ENABLED:
lp->PMEnabled = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MCAST_RX:
lp->MulticastReceive = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MAX_SLEEP_DURATION:
lp->MaxSleepDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_HOLDOVER_DURATION:
lp->holdoverDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_NAME:
memset(lp->StationName, 0, sizeof(lp->StationName));
memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_LOAD_BALANCG:
lp->loadBalancing = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MEDIUM_DISTRIBUTION:
lp->mediumDistribution = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_TX_POW_LVL:
lp->txPowLevel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SUPPORTED_RATE_SET_CNTL:
lp->srsc[0] = pLtv->u.u16[0];
lp->srsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_BASIC_RATE_SET_CNTL:
lp->brsc[0] = pLtv->u.u16[0];
lp->brsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_CNF_CONNECTION_CNTL:
lp->connectionControl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_DTIM_PERIOD:
lp->DTIMPeriod = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_BEACON_TERVAL:
lp->ownBeaconInterval = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_COEXISTENSE_BEHAVIOUR:
lp->coexistence = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_WDS_ADDR1:
memcpy(&lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_1;
break;
case CFG_CNF_WDS_ADDR2:
memcpy(&lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_2;
break;
case CFG_CNF_WDS_ADDR3:
memcpy(&lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_3;
break;
case CFG_CNF_WDS_ADDR4:
memcpy(&lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_4;
break;
case CFG_CNF_WDS_ADDR5:
memcpy(&lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_5;
break;
case CFG_CNF_WDS_ADDR6:
memcpy(&lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_6;
break;
case CFG_CNF_MCAST_PM_BUF:
lp->multicastPMBuffering = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_REJECT_ANY:
lp->RejectAny = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_ENCRYPTION:
lp->EnableEncryption = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_AUTHENTICATION:
lp->authentication = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MCAST_RATE:
break;
case CFG_CNF_TRA_BSS_RELAY:
lp->intraBSSRelay = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MICRO_WAVE:
break;
case CFG_CNF_OWN_SSID:
case CFG_DESIRED_SSID:
memset(lp->NetworkName, 0, sizeof(lp->NetworkName));
memcpy((void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
if ((strlen(&pLtv->u.u8[2]) == 0) || (strcmp(&pLtv->u.u8[2], "ANY") == 0) || (strcmp(&pLtv->u.u8[2], "any") == 0)) {
pLtv->u.u16[0] = 0;
pLtv->u.u8[2] = 0;
}
break;
case CFG_GROUP_ADDR:
break;
case CFG_CREATE_IBSS:
lp->CreateIBSS = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_RTS_THRH:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_TX_RATE_CNTL:
lp->TxRateControl[0] = pLtv->u.u16[0];
lp->TxRateControl[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_PROMISCUOUS_MODE:
break;
case CFG_RTS_THRH0:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_TX_RATE_CNTL0:
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_RTS_THRH1:
lp->wds_port[0].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_1;
break;
case CFG_RTS_THRH2:
lp->wds_port[1].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_2;
break;
case CFG_RTS_THRH3:
lp->wds_port[2].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_3;
break;
case CFG_RTS_THRH4:
lp->wds_port[3].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_4;
break;
case CFG_RTS_THRH5:
lp->wds_port[4].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_5;
break;
case CFG_RTS_THRH6:
lp->wds_port[5].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_6;
break;
case CFG_TX_RATE_CNTL1:
lp->wds_port[0].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_1;
break;
case CFG_TX_RATE_CNTL2:
lp->wds_port[1].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_2;
break;
case CFG_TX_RATE_CNTL3:
lp->wds_port[2].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_3;
break;
case CFG_TX_RATE_CNTL4:
lp->wds_port[3].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_4;
break;
case CFG_TX_RATE_CNTL5:
lp->wds_port[4].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_5;
break;
case CFG_TX_RATE_CNTL6:
lp->wds_port[5].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_6;
break;
case CFG_DEFAULT_KEYS: {
CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv;
pKeys->key[0].len = CNV_T_TO_LITTLE(pKeys->key[0].len);
pKeys->key[1].len = CNV_T_TO_LITTLE(pKeys->key[1].len);
pKeys->key[2].len = CNV_T_TO_LITTLE(pKeys->key[2].len);
pKeys->key[3].len = CNV_T_TO_LITTLE(pKeys->key[3].len);
memcpy((void *)&(lp->DefaultKeys), (void *)pKeys, sizeof(CFG_DEFAULT_KEYS_STRCT));
}
break;
case CFG_TX_KEY_ID:
lp->TransmitKeyID = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SCAN_SSID:
break;
case CFG_TICK_TIME:
break;
case CFG_MAX_LOAD_TIME:
case CFG_DL_BUF:
case CFG_NIC_SERIAL_NUMBER:
case CFG_NIC_IDENTITY:
case CFG_NIC_MFI_SUP_RANGE:
case CFG_NIC_CFI_SUP_RANGE:
case CFG_NIC_TEMP_TYPE:
case CFG_NIC_PROFILE:
case CFG_FW_IDENTITY:
case CFG_FW_SUP_RANGE:
case CFG_MFI_ACT_RANGES_STA:
case CFG_CFI_ACT_RANGES_STA:
case CFG_PORT_STAT:
case CFG_CUR_SSID:
case CFG_CUR_BSSID:
case CFG_COMMS_QUALITY:
case CFG_CUR_TX_RATE:
case CFG_CUR_BEACON_TERVAL:
case CFG_CUR_SCALE_THRH:
case CFG_PROTOCOL_RSP_TIME:
case CFG_CUR_SHORT_RETRY_LIMIT:
case CFG_CUR_LONG_RETRY_LIMIT:
case CFG_MAX_TX_LIFETIME:
case CFG_MAX_RX_LIFETIME:
case CFG_CF_POLLABLE:
case CFG_AUTHENTICATION_ALGORITHMS:
case CFG_PRIVACY_OPT_IMPLEMENTED:
case CFG_NIC_MAC_ADDR:
case CFG_PCF_FO:
case CFG_PHY_TYPE:
case CFG_CUR_CHANNEL:
case CFG_SUPPORTED_DATA_RATES:
break;
case CFG_AP_MODE:
DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported\n");
break;
case CFG_ENCRYPT_STRG:
memset(lp->szEncryption, 0, sizeof(lp->szEncryption));
memcpy((void *)lp->szEncryption, (void *)&pLtv->u.u8[0], (pLtv->len * sizeof(hcf_16)));
wl_wep_decode(CRYPT_CODE, &sEncryption, lp->szEncryption);
lp->TransmitKeyID = sEncryption.wTxKeyID + 1;
lp->EnableEncryption = sEncryption.wEnabled;
memcpy(&lp->DefaultKeys, &sEncryption.EncStr, sizeof(CFG_DEFAULT_KEYS_STRCT));
break;
case CFG_DRIVER_ENABLE:
lp->driverEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_WOLAS_ENABLE:
lp->wolasEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE:
lp->AuthKeyMgmtSuite = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_DISASSOCIATE_ADDR:
pLtv->u.u16[ETH_ALEN / 2] = CNV_T_TO_LITTLE(pLtv->u.u16[ETH_ALEN / 2]);
break;
case CFG_ADD_TKIP_DEFAULT_KEY:
case CFG_REMOVE_TKIP_DEFAULT_KEY:
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_ADD_TKIP_MAPPED_KEY:
break;
case CFG_REMOVE_TKIP_MAPPED_KEY:
break;
case CFG_MB_FO:
case CFG_IFB:
default:
break;
}
switch (pLtv->typ) {
case CFG_CNF_PORT_TYPE:
case CFG_CNF_OWN_MAC_ADDR:
case CFG_CNF_OWN_CHANNEL:
case CFG_CNF_OWN_SSID:
case CFG_CNF_OWN_ATIM_WDOW:
case CFG_CNF_SYSTEM_SCALE:
case CFG_CNF_MAX_DATA_LEN:
case CFG_CNF_PM_ENABLED:
case CFG_CNF_MCAST_RX:
case CFG_CNF_MAX_SLEEP_DURATION:
case CFG_CNF_HOLDOVER_DURATION:
case CFG_CNF_OWN_NAME:
case CFG_CNF_LOAD_BALANCG:
case CFG_CNF_MEDIUM_DISTRIBUTION:
case CFG_CNF_TX_POW_LVL:
case CFG_CNF_CONNECTION_CNTL:
case CFG_CNF_OWN_DTIM_PERIOD:
case CFG_CNF_OWN_BEACON_TERVAL:
case CFG_CNF_WDS_ADDR1:
case CFG_CNF_WDS_ADDR2:
case CFG_CNF_WDS_ADDR3:
case CFG_CNF_WDS_ADDR4:
case CFG_CNF_WDS_ADDR5:
case CFG_CNF_WDS_ADDR6:
case CFG_CNF_MCAST_PM_BUF:
case CFG_CNF_REJECT_ANY:
case CFG_CNF_ENCRYPTION:
case CFG_CNF_AUTHENTICATION:
case CFG_CNF_EXCL_UNENCRYPTED:
case CFG_CNF_MCAST_RATE:
case CFG_CNF_TRA_BSS_RELAY:
case CFG_CNF_MICRO_WAVE:
case CFG_AP_MODE:
case CFG_ENCRYPT_STRG:
case CFG_WOLAS_ENABLE:
case CFG_MB_FO:
case CFG_IFB:
break;
case CFG_DRIVER_ENABLE:
if (lp->driverEnable) {
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_ENABLE | HCF_PORT_0);
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_CONNECT);
} else {
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISABLE | HCF_PORT_0);
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISCONNECT);
}
break;
default:
wl_act_int_off(lp);
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on(lp);
break;
}
if (ltvAllocated) {
kfree(pLtv);
}
} else {
urq->result = UIL_FAILURE;
}
} else {
DBG_ERROR(DbgInfo, "EPERM\n");
urq->result = UIL_FAILURE;
result = -EPERM;
}
} else {
DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
urq->result = UIL_ERR_WRONG_IFB;
}
DBG_LEAVE(DbgInfo);
return result;
}
|
int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) {
int result = 0;
ltv_t *pLtv;
bool_t ltvAllocated = FALSE;
ENCSTRCT sEncryption;
size_t len;
hcf_16 hcfPort = HCF_PORT_0;
DBG_FUNC("wvlan_uil_put_info");
DBG_ENTER(DbgInfo);
if (urq->hcfCtx == &(lp->hcfCtx)) {
if (capable(CAP_NET_ADM)) {
if ((urq->data != NULL) && (urq->len != 0)) {
if (urq->len < (sizeof(hcf_16) * 2)) {
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
DBG_ERROR(DbgInfo, "No Length/Type in LTV!!!\n");
DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
DBG_LEAVE(DbgInfo);
return result;
}
result = verify_area(VERIFY_READ, urq->data, urq->len);
if (result != 0) {
urq->result = UIL_FAILURE;
DBG_ERROR(DbgInfo, "verify_area(), VERIFY_READ FAILED\n");
DBG_LEAVE(DbgInfo);
return result;
}
copy_from_user(&(lp->ltvRecord), urq->data, sizeof(hcf_16) * 2);
if (((lp->ltvRecord.len + 1) * sizeof(hcf_16)) > urq->len) {
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
DBG_ERROR(DbgInfo, "UIL_ERR_LEN\n");
DBG_LEAVE(DbgInfo);
return result;
}
if (urq->len > sizeof(lp->ltvRecord)) {
pLtv = kmalloc(urq->len, GFP_KERNEL);
if (pLtv != NULL) {
ltvAllocated = TRUE;
} else {
DBG_ERROR(DbgInfo, "Alloc FAILED\n");
urq->len = sizeof(lp->ltvRecord);
urq->result = UIL_ERR_LEN;
result = -ENOMEM;
DBG_LEAVE(DbgInfo);
return result;
}
} else {
pLtv = &(lp->ltvRecord);
}
copy_from_user(pLtv, urq->data, urq->len);
switch (pLtv->typ) {
case CFG_CNF_PORT_TYPE:
lp->PortType = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_MAC_ADDR:
break;
case CFG_CNF_OWN_CHANNEL:
lp->Channel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_ATIM_WDOW:
lp->atimWindow = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_SYSTEM_SCALE:
lp->DistanceBetweenAPs = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
case CFG_CNF_MAX_DATA_LEN:
break;
case CFG_CNF_PM_ENABLED:
lp->PMEnabled = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MCAST_RX:
lp->MulticastReceive = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MAX_SLEEP_DURATION:
lp->MaxSleepDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_HOLDOVER_DURATION:
lp->holdoverDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_NAME:
memset(lp->StationName, 0, sizeof(lp->StationName));
len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
strlcpy(lp->StationName, &pLtv->u.u8[2], len);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_LOAD_BALANCG:
lp->loadBalancing = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MEDIUM_DISTRIBUTION:
lp->mediumDistribution = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_TX_POW_LVL:
lp->txPowLevel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SUPPORTED_RATE_SET_CNTL:
lp->srsc[0] = pLtv->u.u16[0];
lp->srsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_BASIC_RATE_SET_CNTL:
lp->brsc[0] = pLtv->u.u16[0];
lp->brsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_CNF_CONNECTION_CNTL:
lp->connectionControl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_DTIM_PERIOD:
lp->DTIMPeriod = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_OWN_BEACON_TERVAL:
lp->ownBeaconInterval = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_COEXISTENSE_BEHAVIOUR:
lp->coexistence = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_WDS_ADDR1:
memcpy(&lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_1;
break;
case CFG_CNF_WDS_ADDR2:
memcpy(&lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_2;
break;
case CFG_CNF_WDS_ADDR3:
memcpy(&lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_3;
break;
case CFG_CNF_WDS_ADDR4:
memcpy(&lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_4;
break;
case CFG_CNF_WDS_ADDR5:
memcpy(&lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_5;
break;
case CFG_CNF_WDS_ADDR6:
memcpy(&lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN);
hcfPort = HCF_PORT_6;
break;
case CFG_CNF_MCAST_PM_BUF:
lp->multicastPMBuffering = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_REJECT_ANY:
lp->RejectAny = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_ENCRYPTION:
lp->EnableEncryption = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_AUTHENTICATION:
lp->authentication = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MCAST_RATE:
break;
case CFG_CNF_TRA_BSS_RELAY:
lp->intraBSSRelay = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_CNF_MICRO_WAVE:
break;
case CFG_CNF_OWN_SSID:
case CFG_DESIRED_SSID:
memset(lp->NetworkName, 0, sizeof(lp->NetworkName));
memcpy((void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
if ((strlen(&pLtv->u.u8[2]) == 0) || (strcmp(&pLtv->u.u8[2], "ANY") == 0) || (strcmp(&pLtv->u.u8[2], "any") == 0)) {
pLtv->u.u16[0] = 0;
pLtv->u.u8[2] = 0;
}
break;
case CFG_GROUP_ADDR:
break;
case CFG_CREATE_IBSS:
lp->CreateIBSS = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_RTS_THRH:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_TX_RATE_CNTL:
lp->TxRateControl[0] = pLtv->u.u16[0];
lp->TxRateControl[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
pLtv->u.u16[1] = CNV_T_TO_LITTLE(pLtv->u.u16[1]);
break;
case CFG_PROMISCUOUS_MODE:
break;
case CFG_RTS_THRH0:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_TX_RATE_CNTL0:
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_RTS_THRH1:
lp->wds_port[0].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_1;
break;
case CFG_RTS_THRH2:
lp->wds_port[1].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_2;
break;
case CFG_RTS_THRH3:
lp->wds_port[2].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_3;
break;
case CFG_RTS_THRH4:
lp->wds_port[3].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_4;
break;
case CFG_RTS_THRH5:
lp->wds_port[4].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_5;
break;
case CFG_RTS_THRH6:
lp->wds_port[5].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_6;
break;
case CFG_TX_RATE_CNTL1:
lp->wds_port[0].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_1;
break;
case CFG_TX_RATE_CNTL2:
lp->wds_port[1].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_2;
break;
case CFG_TX_RATE_CNTL3:
lp->wds_port[2].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_3;
break;
case CFG_TX_RATE_CNTL4:
lp->wds_port[3].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_4;
break;
case CFG_TX_RATE_CNTL5:
lp->wds_port[4].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_5;
break;
case CFG_TX_RATE_CNTL6:
lp->wds_port[5].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
hcfPort = HCF_PORT_6;
break;
case CFG_DEFAULT_KEYS: {
CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv;
pKeys->key[0].len = CNV_T_TO_LITTLE(pKeys->key[0].len);
pKeys->key[1].len = CNV_T_TO_LITTLE(pKeys->key[1].len);
pKeys->key[2].len = CNV_T_TO_LITTLE(pKeys->key[2].len);
pKeys->key[3].len = CNV_T_TO_LITTLE(pKeys->key[3].len);
memcpy((void *)&(lp->DefaultKeys), (void *)pKeys, sizeof(CFG_DEFAULT_KEYS_STRCT));
}
break;
case CFG_TX_KEY_ID:
lp->TransmitKeyID = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SCAN_SSID:
break;
case CFG_TICK_TIME:
break;
case CFG_MAX_LOAD_TIME:
case CFG_DL_BUF:
case CFG_NIC_SERIAL_NUMBER:
case CFG_NIC_IDENTITY:
case CFG_NIC_MFI_SUP_RANGE:
case CFG_NIC_CFI_SUP_RANGE:
case CFG_NIC_TEMP_TYPE:
case CFG_NIC_PROFILE:
case CFG_FW_IDENTITY:
case CFG_FW_SUP_RANGE:
case CFG_MFI_ACT_RANGES_STA:
case CFG_CFI_ACT_RANGES_STA:
case CFG_PORT_STAT:
case CFG_CUR_SSID:
case CFG_CUR_BSSID:
case CFG_COMMS_QUALITY:
case CFG_CUR_TX_RATE:
case CFG_CUR_BEACON_TERVAL:
case CFG_CUR_SCALE_THRH:
case CFG_PROTOCOL_RSP_TIME:
case CFG_CUR_SHORT_RETRY_LIMIT:
case CFG_CUR_LONG_RETRY_LIMIT:
case CFG_MAX_TX_LIFETIME:
case CFG_MAX_RX_LIFETIME:
case CFG_CF_POLLABLE:
case CFG_AUTHENTICATION_ALGORITHMS:
case CFG_PRIVACY_OPT_IMPLEMENTED:
case CFG_NIC_MAC_ADDR:
case CFG_PCF_FO:
case CFG_PHY_TYPE:
case CFG_CUR_CHANNEL:
case CFG_SUPPORTED_DATA_RATES:
break;
case CFG_AP_MODE:
DBG_ERROR(DbgInfo, "set CFG_AP_MODE no longer supported\n");
break;
case CFG_ENCRYPT_STRG:
memset(lp->szEncryption, 0, sizeof(lp->szEncryption));
memcpy((void *)lp->szEncryption, (void *)&pLtv->u.u8[0], (pLtv->len * sizeof(hcf_16)));
wl_wep_decode(CRYPT_CODE, &sEncryption, lp->szEncryption);
lp->TransmitKeyID = sEncryption.wTxKeyID + 1;
lp->EnableEncryption = sEncryption.wEnabled;
memcpy(&lp->DefaultKeys, &sEncryption.EncStr, sizeof(CFG_DEFAULT_KEYS_STRCT));
break;
case CFG_DRIVER_ENABLE:
lp->driverEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_WOLAS_ENABLE:
lp->wolasEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE:
lp->AuthKeyMgmtSuite = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_DISASSOCIATE_ADDR:
pLtv->u.u16[ETH_ALEN / 2] = CNV_T_TO_LITTLE(pLtv->u.u16[ETH_ALEN / 2]);
break;
case CFG_ADD_TKIP_DEFAULT_KEY:
case CFG_REMOVE_TKIP_DEFAULT_KEY:
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
case CFG_ADD_TKIP_MAPPED_KEY:
break;
case CFG_REMOVE_TKIP_MAPPED_KEY:
break;
case CFG_MB_FO:
case CFG_IFB:
default:
break;
}
switch (pLtv->typ) {
case CFG_CNF_PORT_TYPE:
case CFG_CNF_OWN_MAC_ADDR:
case CFG_CNF_OWN_CHANNEL:
case CFG_CNF_OWN_SSID:
case CFG_CNF_OWN_ATIM_WDOW:
case CFG_CNF_SYSTEM_SCALE:
case CFG_CNF_MAX_DATA_LEN:
case CFG_CNF_PM_ENABLED:
case CFG_CNF_MCAST_RX:
case CFG_CNF_MAX_SLEEP_DURATION:
case CFG_CNF_HOLDOVER_DURATION:
case CFG_CNF_OWN_NAME:
case CFG_CNF_LOAD_BALANCG:
case CFG_CNF_MEDIUM_DISTRIBUTION:
case CFG_CNF_TX_POW_LVL:
case CFG_CNF_CONNECTION_CNTL:
case CFG_CNF_OWN_DTIM_PERIOD:
case CFG_CNF_OWN_BEACON_TERVAL:
case CFG_CNF_WDS_ADDR1:
case CFG_CNF_WDS_ADDR2:
case CFG_CNF_WDS_ADDR3:
case CFG_CNF_WDS_ADDR4:
case CFG_CNF_WDS_ADDR5:
case CFG_CNF_WDS_ADDR6:
case CFG_CNF_MCAST_PM_BUF:
case CFG_CNF_REJECT_ANY:
case CFG_CNF_ENCRYPTION:
case CFG_CNF_AUTHENTICATION:
case CFG_CNF_EXCL_UNENCRYPTED:
case CFG_CNF_MCAST_RATE:
case CFG_CNF_TRA_BSS_RELAY:
case CFG_CNF_MICRO_WAVE:
case CFG_AP_MODE:
case CFG_ENCRYPT_STRG:
case CFG_WOLAS_ENABLE:
case CFG_MB_FO:
case CFG_IFB:
break;
case CFG_DRIVER_ENABLE:
if (lp->driverEnable) {
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_ENABLE | HCF_PORT_0);
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_CONNECT);
} else {
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISABLE | HCF_PORT_0);
hcf_cntl(&(lp->hcfCtx), HCF_CNTL_DISCONNECT);
}
break;
default:
wl_act_int_off(lp);
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on(lp);
break;
}
if (ltvAllocated) {
kfree(pLtv);
}
} else {
urq->result = UIL_FAILURE;
}
} else {
DBG_ERROR(DbgInfo, "EPERM\n");
urq->result = UIL_FAILURE;
result = -EPERM;
}
} else {
DBG_ERROR(DbgInfo, "UIL_ERR_WRONG_IFB\n");
urq->result = UIL_ERR_WRONG_IFB;
}
DBG_LEAVE(DbgInfo);
return result;
}
|
int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) {
int result = 0;
ltv_t *pLtv;
bool_t ltvAllocated = FALSE;
ENCSTRCT sEncryption;
hcf_16 hcfPort = HCF_PORT_0;
DBG_FUNC( "wvlan_uil_put_info" );
DBG_ENTER( DbgInfo );
if( urq->hcfCtx == &( lp->hcfCtx )) {
if( capable( CAP_NET_ADM )) {
if(( urq->data != NULL ) && ( urq->len != 0 )) {
if( urq->len < ( sizeof( hcf_16 ) * 2 )) {
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" );
DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" );
DBG_LEAVE( DbgInfo );
return result;
}
result = verify_area( VERIFY_READ, urq->data, urq->len );
if( result != 0 ) {
urq->result = UIL_FAILURE;
DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" );
DBG_LEAVE( DbgInfo );
return result;
}
copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 );
if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) {
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" );
DBG_LEAVE( DbgInfo );
return result;
}
if( urq->len > sizeof( lp->ltvRecord )) {
pLtv = kmalloc(urq->len, GFP_KERNEL);
if (pLtv != NULL) {
ltvAllocated = TRUE;
} else {
DBG_ERROR( DbgInfo, "Alloc FAILED\n" );
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
result = -ENOMEM;
DBG_LEAVE( DbgInfo );
return result;
}
} else {
pLtv = &( lp->ltvRecord );
}
copy_from_user( pLtv, urq->data, urq->len );
switch( pLtv->typ ) {
case CFG_CNF_PORT_TYPE:
lp->PortType = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_MAC_ADDR:
break;
case CFG_CNF_OWN_CHANNEL:
lp->Channel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_ATIM_WDOW:
lp->atimWindow = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_SYSTEM_SCALE:
lp->DistanceBetweenAPs = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
case CFG_CNF_MAX_DATA_LEN:
break;
case CFG_CNF_PM_ENABLED:
lp->PMEnabled = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MCAST_RX:
lp->MulticastReceive = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MAX_SLEEP_DURATION:
lp->MaxSleepDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_HOLDOVER_DURATION:
lp->holdoverDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_NAME:
memset( lp->StationName, 0, sizeof( lp->StationName ));
memcpy( (void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_LOAD_BALANCG:
lp->loadBalancing = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MEDIUM_DISTRIBUTION:
lp->mediumDistribution = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_TX_POW_LVL:
lp->txPowLevel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SUPPORTED_RATE_SET_CNTL:
lp->srsc[0] = pLtv->u.u16[0];
lp->srsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_BASIC_RATE_SET_CNTL:
lp->brsc[0] = pLtv->u.u16[0];
lp->brsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_CNF_CONNECTION_CNTL:
lp->connectionControl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_DTIM_PERIOD:
lp->DTIMPeriod = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_BEACON_TERVAL:
lp->ownBeaconInterval = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_COEXISTENSE_BEHAVIOUR:
lp->coexistence = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_WDS_ADDR1:
memcpy( &lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_1;
break;
case CFG_CNF_WDS_ADDR2:
memcpy( &lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_2;
break;
case CFG_CNF_WDS_ADDR3:
memcpy( &lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_3;
break;
case CFG_CNF_WDS_ADDR4:
memcpy( &lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_4;
break;
case CFG_CNF_WDS_ADDR5:
memcpy( &lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_5;
break;
case CFG_CNF_WDS_ADDR6:
memcpy( &lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_6;
break;
case CFG_CNF_MCAST_PM_BUF:
lp->multicastPMBuffering = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_REJECT_ANY:
lp->RejectAny = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_ENCRYPTION:
lp->EnableEncryption = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_AUTHENTICATION:
lp->authentication = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MCAST_RATE:
break;
case CFG_CNF_TRA_BSS_RELAY:
lp->intraBSSRelay = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MICRO_WAVE:
break;
case CFG_CNF_OWN_SSID:
case CFG_DESIRED_SSID:
memset( lp->NetworkName, 0, sizeof( lp->NetworkName ));
memcpy( (void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0] );
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
if(( strlen( &pLtv->u.u8[2] ) == 0 ) || ( strcmp( &pLtv->u.u8[2], "ANY" ) == 0 ) || ( strcmp( &pLtv->u.u8[2], "any" ) == 0 )) {
pLtv->u.u16[0] = 0;
pLtv->u.u8[2] = 0;
}
break;
case CFG_GROUP_ADDR:
break;
case CFG_CREATE_IBSS:
lp->CreateIBSS = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_RTS_THRH:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_TX_RATE_CNTL:
lp->TxRateControl[0] = pLtv->u.u16[0];
lp->TxRateControl[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_PROMISCUOUS_MODE:
break;
case CFG_RTS_THRH0:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_TX_RATE_CNTL0:
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_RTS_THRH1:
lp->wds_port[0].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_1;
break;
case CFG_RTS_THRH2:
lp->wds_port[1].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_2;
break;
case CFG_RTS_THRH3:
lp->wds_port[2].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_3;
break;
case CFG_RTS_THRH4:
lp->wds_port[3].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_4;
break;
case CFG_RTS_THRH5:
lp->wds_port[4].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_5;
break;
case CFG_RTS_THRH6:
lp->wds_port[5].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_6;
break;
case CFG_TX_RATE_CNTL1:
lp->wds_port[0].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_1;
break;
case CFG_TX_RATE_CNTL2:
lp->wds_port[1].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_2;
break;
case CFG_TX_RATE_CNTL3:
lp->wds_port[2].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_3;
break;
case CFG_TX_RATE_CNTL4:
lp->wds_port[3].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_4;
break;
case CFG_TX_RATE_CNTL5:
lp->wds_port[4].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_5;
break;
case CFG_TX_RATE_CNTL6:
lp->wds_port[5].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_6;
break;
case CFG_DEFAULT_KEYS: {
CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv;
pKeys->key[0].len = CNV_T_TO_LITTLE( pKeys->key[0].len );
pKeys->key[1].len = CNV_T_TO_LITTLE( pKeys->key[1].len );
pKeys->key[2].len = CNV_T_TO_LITTLE( pKeys->key[2].len );
pKeys->key[3].len = CNV_T_TO_LITTLE( pKeys->key[3].len );
memcpy( (void *)&(lp->DefaultKeys), (void *)pKeys, sizeof( CFG_DEFAULT_KEYS_STRCT ));
}
break;
case CFG_TX_KEY_ID:
lp->TransmitKeyID = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SCAN_SSID:
break;
case CFG_TICK_TIME:
break;
case CFG_MAX_LOAD_TIME:
case CFG_DL_BUF:
case CFG_NIC_SERIAL_NUMBER:
case CFG_NIC_IDENTITY:
case CFG_NIC_MFI_SUP_RANGE:
case CFG_NIC_CFI_SUP_RANGE:
case CFG_NIC_TEMP_TYPE:
case CFG_NIC_PROFILE:
case CFG_FW_IDENTITY:
case CFG_FW_SUP_RANGE:
case CFG_MFI_ACT_RANGES_STA:
case CFG_CFI_ACT_RANGES_STA:
case CFG_PORT_STAT:
case CFG_CUR_SSID:
case CFG_CUR_BSSID:
case CFG_COMMS_QUALITY:
case CFG_CUR_TX_RATE:
case CFG_CUR_BEACON_TERVAL:
case CFG_CUR_SCALE_THRH:
case CFG_PROTOCOL_RSP_TIME:
case CFG_CUR_SHORT_RETRY_LIMIT:
case CFG_CUR_LONG_RETRY_LIMIT:
case CFG_MAX_TX_LIFETIME:
case CFG_MAX_RX_LIFETIME:
case CFG_CF_POLLABLE:
case CFG_AUTHENTICATION_ALGORITHMS:
case CFG_PRIVACY_OPT_IMPLEMENTED:
case CFG_NIC_MAC_ADDR:
case CFG_PCF_FO:
case CFG_PHY_TYPE:
case CFG_CUR_CHANNEL:
case CFG_SUPPORTED_DATA_RATES:
break;
case CFG_AP_MODE:
DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported\n" );
break;
case CFG_ENCRYPT_STRG:
memset( lp->szEncryption, 0, sizeof( lp->szEncryption ));
memcpy( (void *)lp->szEncryption, (void *)&pLtv->u.u8[0], ( pLtv->len * sizeof( hcf_16 )) );
wl_wep_decode( CRYPT_CODE, &sEncryption, lp->szEncryption );
lp->TransmitKeyID = sEncryption.wTxKeyID + 1;
lp->EnableEncryption = sEncryption.wEnabled;
memcpy( &lp->DefaultKeys, &sEncryption.EncStr, sizeof( CFG_DEFAULT_KEYS_STRCT ));
break;
case CFG_DRIVER_ENABLE:
lp->driverEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_WOLAS_ENABLE:
lp->wolasEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE:
lp->AuthKeyMgmtSuite = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_DISASSOCIATE_ADDR:
pLtv->u.u16[ETH_ALEN / 2] = CNV_T_TO_LITTLE( pLtv->u.u16[ETH_ALEN / 2] );
break;
case CFG_ADD_TKIP_DEFAULT_KEY:
case CFG_REMOVE_TKIP_DEFAULT_KEY:
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_ADD_TKIP_MAPPED_KEY:
break;
case CFG_REMOVE_TKIP_MAPPED_KEY:
break;
case CFG_MB_FO:
case CFG_IFB:
default:
break;
}
switch( pLtv->typ ) {
case CFG_CNF_PORT_TYPE:
case CFG_CNF_OWN_MAC_ADDR:
case CFG_CNF_OWN_CHANNEL:
case CFG_CNF_OWN_SSID:
case CFG_CNF_OWN_ATIM_WDOW:
case CFG_CNF_SYSTEM_SCALE:
case CFG_CNF_MAX_DATA_LEN:
case CFG_CNF_PM_ENABLED:
case CFG_CNF_MCAST_RX:
case CFG_CNF_MAX_SLEEP_DURATION:
case CFG_CNF_HOLDOVER_DURATION:
case CFG_CNF_OWN_NAME:
case CFG_CNF_LOAD_BALANCG:
case CFG_CNF_MEDIUM_DISTRIBUTION:
case CFG_CNF_TX_POW_LVL:
case CFG_CNF_CONNECTION_CNTL:
case CFG_CNF_OWN_DTIM_PERIOD:
case CFG_CNF_OWN_BEACON_TERVAL:
case CFG_CNF_WDS_ADDR1:
case CFG_CNF_WDS_ADDR2:
case CFG_CNF_WDS_ADDR3:
case CFG_CNF_WDS_ADDR4:
case CFG_CNF_WDS_ADDR5:
case CFG_CNF_WDS_ADDR6:
case CFG_CNF_MCAST_PM_BUF:
case CFG_CNF_REJECT_ANY:
case CFG_CNF_ENCRYPTION:
case CFG_CNF_AUTHENTICATION:
case CFG_CNF_EXCL_UNENCRYPTED:
case CFG_CNF_MCAST_RATE:
case CFG_CNF_TRA_BSS_RELAY:
case CFG_CNF_MICRO_WAVE:
case CFG_AP_MODE:
case CFG_ENCRYPT_STRG:
case CFG_WOLAS_ENABLE:
case CFG_MB_FO:
case CFG_IFB:
break;
case CFG_DRIVER_ENABLE:
if( lp->driverEnable ) {
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE | HCF_PORT_0 );
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT );
} else {
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE | HCF_PORT_0 );
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT );
}
break;
default:
wl_act_int_off( lp );
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on( lp );
break;
}
if( ltvAllocated ) {
kfree( pLtv );
}
} else {
urq->result = UIL_FAILURE;
}
} else {
DBG_ERROR( DbgInfo, "EPERM\n" );
urq->result = UIL_FAILURE;
result = -EPERM;
}
} else {
DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" );
urq->result = UIL_ERR_WRONG_IFB;
}
DBG_LEAVE( DbgInfo );
return result;
}
|
int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) {
int result = 0;
ltv_t *pLtv;
bool_t ltvAllocated = FALSE;
ENCSTRCT sEncryption;
size_t len;
hcf_16 hcfPort = HCF_PORT_0;
DBG_FUNC( "wvlan_uil_put_info" );
DBG_ENTER( DbgInfo );
if( urq->hcfCtx == &( lp->hcfCtx )) {
if( capable( CAP_NET_ADM )) {
if(( urq->data != NULL ) && ( urq->len != 0 )) {
if( urq->len < ( sizeof( hcf_16 ) * 2 )) {
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
DBG_ERROR( DbgInfo, "No Length/Type in LTV!!!\n" );
DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" );
DBG_LEAVE( DbgInfo );
return result;
}
result = verify_area( VERIFY_READ, urq->data, urq->len );
if( result != 0 ) {
urq->result = UIL_FAILURE;
DBG_ERROR( DbgInfo, "verify_area(), VERIFY_READ FAILED\n" );
DBG_LEAVE( DbgInfo );
return result;
}
copy_from_user( &( lp->ltvRecord ), urq->data, sizeof( hcf_16 ) * 2 );
if((( lp->ltvRecord.len + 1 ) * sizeof( hcf_16 )) > urq->len ) {
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
DBG_ERROR( DbgInfo, "UIL_ERR_LEN\n" );
DBG_LEAVE( DbgInfo );
return result;
}
if( urq->len > sizeof( lp->ltvRecord )) {
pLtv = kmalloc(urq->len, GFP_KERNEL);
if (pLtv != NULL) {
ltvAllocated = TRUE;
} else {
DBG_ERROR( DbgInfo, "Alloc FAILED\n" );
urq->len = sizeof( lp->ltvRecord );
urq->result = UIL_ERR_LEN;
result = -ENOMEM;
DBG_LEAVE( DbgInfo );
return result;
}
} else {
pLtv = &( lp->ltvRecord );
}
copy_from_user( pLtv, urq->data, urq->len );
switch( pLtv->typ ) {
case CFG_CNF_PORT_TYPE:
lp->PortType = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_MAC_ADDR:
break;
case CFG_CNF_OWN_CHANNEL:
lp->Channel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_ATIM_WDOW:
lp->atimWindow = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_SYSTEM_SCALE:
lp->DistanceBetweenAPs = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
case CFG_CNF_MAX_DATA_LEN:
break;
case CFG_CNF_PM_ENABLED:
lp->PMEnabled = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MCAST_RX:
lp->MulticastReceive = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MAX_SLEEP_DURATION:
lp->MaxSleepDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_HOLDOVER_DURATION:
lp->holdoverDuration = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_NAME:
memset( lp->StationName, 0, sizeof( lp->StationName ));
len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
strlcpy(lp->StationName, &pLtv->u.u8[2], len);
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_LOAD_BALANCG:
lp->loadBalancing = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MEDIUM_DISTRIBUTION:
lp->mediumDistribution = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_TX_POW_LVL:
lp->txPowLevel = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SUPPORTED_RATE_SET_CNTL:
lp->srsc[0] = pLtv->u.u16[0];
lp->srsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_BASIC_RATE_SET_CNTL:
lp->brsc[0] = pLtv->u.u16[0];
lp->brsc[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_CNF_CONNECTION_CNTL:
lp->connectionControl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_DTIM_PERIOD:
lp->DTIMPeriod = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_OWN_BEACON_TERVAL:
lp->ownBeaconInterval = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_COEXISTENSE_BEHAVIOUR:
lp->coexistence = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_WDS_ADDR1:
memcpy( &lp->wds_port[0].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_1;
break;
case CFG_CNF_WDS_ADDR2:
memcpy( &lp->wds_port[1].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_2;
break;
case CFG_CNF_WDS_ADDR3:
memcpy( &lp->wds_port[2].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_3;
break;
case CFG_CNF_WDS_ADDR4:
memcpy( &lp->wds_port[3].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_4;
break;
case CFG_CNF_WDS_ADDR5:
memcpy( &lp->wds_port[4].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_5;
break;
case CFG_CNF_WDS_ADDR6:
memcpy( &lp->wds_port[5].wdsAddress, &pLtv->u.u8[0], ETH_ALEN );
hcfPort = HCF_PORT_6;
break;
case CFG_CNF_MCAST_PM_BUF:
lp->multicastPMBuffering = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_REJECT_ANY:
lp->RejectAny = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_ENCRYPTION:
lp->EnableEncryption = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_AUTHENTICATION:
lp->authentication = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MCAST_RATE:
break;
case CFG_CNF_TRA_BSS_RELAY:
lp->intraBSSRelay = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_CNF_MICRO_WAVE:
break;
case CFG_CNF_OWN_SSID:
case CFG_DESIRED_SSID:
memset( lp->NetworkName, 0, sizeof( lp->NetworkName ));
memcpy( (void *)lp->NetworkName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0] );
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
if(( strlen( &pLtv->u.u8[2] ) == 0 ) || ( strcmp( &pLtv->u.u8[2], "ANY" ) == 0 ) || ( strcmp( &pLtv->u.u8[2], "any" ) == 0 )) {
pLtv->u.u16[0] = 0;
pLtv->u.u8[2] = 0;
}
break;
case CFG_GROUP_ADDR:
break;
case CFG_CREATE_IBSS:
lp->CreateIBSS = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_RTS_THRH:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_TX_RATE_CNTL:
lp->TxRateControl[0] = pLtv->u.u16[0];
lp->TxRateControl[1] = pLtv->u.u16[1];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
pLtv->u.u16[1] = CNV_T_TO_LITTLE( pLtv->u.u16[1] );
break;
case CFG_PROMISCUOUS_MODE:
break;
case CFG_RTS_THRH0:
lp->RTSThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_TX_RATE_CNTL0:
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_RTS_THRH1:
lp->wds_port[0].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_1;
break;
case CFG_RTS_THRH2:
lp->wds_port[1].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_2;
break;
case CFG_RTS_THRH3:
lp->wds_port[2].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_3;
break;
case CFG_RTS_THRH4:
lp->wds_port[3].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_4;
break;
case CFG_RTS_THRH5:
lp->wds_port[4].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_5;
break;
case CFG_RTS_THRH6:
lp->wds_port[5].rtsThreshold = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_6;
break;
case CFG_TX_RATE_CNTL1:
lp->wds_port[0].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_1;
break;
case CFG_TX_RATE_CNTL2:
lp->wds_port[1].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_2;
break;
case CFG_TX_RATE_CNTL3:
lp->wds_port[2].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_3;
break;
case CFG_TX_RATE_CNTL4:
lp->wds_port[3].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_4;
break;
case CFG_TX_RATE_CNTL5:
lp->wds_port[4].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_5;
break;
case CFG_TX_RATE_CNTL6:
lp->wds_port[5].txRateCntl = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
hcfPort = HCF_PORT_6;
break;
case CFG_DEFAULT_KEYS: {
CFG_DEFAULT_KEYS_STRCT *pKeys = (CFG_DEFAULT_KEYS_STRCT *)pLtv;
pKeys->key[0].len = CNV_T_TO_LITTLE( pKeys->key[0].len );
pKeys->key[1].len = CNV_T_TO_LITTLE( pKeys->key[1].len );
pKeys->key[2].len = CNV_T_TO_LITTLE( pKeys->key[2].len );
pKeys->key[3].len = CNV_T_TO_LITTLE( pKeys->key[3].len );
memcpy( (void *)&(lp->DefaultKeys), (void *)pKeys, sizeof( CFG_DEFAULT_KEYS_STRCT ));
}
break;
case CFG_TX_KEY_ID:
lp->TransmitKeyID = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SCAN_SSID:
break;
case CFG_TICK_TIME:
break;
case CFG_MAX_LOAD_TIME:
case CFG_DL_BUF:
case CFG_NIC_SERIAL_NUMBER:
case CFG_NIC_IDENTITY:
case CFG_NIC_MFI_SUP_RANGE:
case CFG_NIC_CFI_SUP_RANGE:
case CFG_NIC_TEMP_TYPE:
case CFG_NIC_PROFILE:
case CFG_FW_IDENTITY:
case CFG_FW_SUP_RANGE:
case CFG_MFI_ACT_RANGES_STA:
case CFG_CFI_ACT_RANGES_STA:
case CFG_PORT_STAT:
case CFG_CUR_SSID:
case CFG_CUR_BSSID:
case CFG_COMMS_QUALITY:
case CFG_CUR_TX_RATE:
case CFG_CUR_BEACON_TERVAL:
case CFG_CUR_SCALE_THRH:
case CFG_PROTOCOL_RSP_TIME:
case CFG_CUR_SHORT_RETRY_LIMIT:
case CFG_CUR_LONG_RETRY_LIMIT:
case CFG_MAX_TX_LIFETIME:
case CFG_MAX_RX_LIFETIME:
case CFG_CF_POLLABLE:
case CFG_AUTHENTICATION_ALGORITHMS:
case CFG_PRIVACY_OPT_IMPLEMENTED:
case CFG_NIC_MAC_ADDR:
case CFG_PCF_FO:
case CFG_PHY_TYPE:
case CFG_CUR_CHANNEL:
case CFG_SUPPORTED_DATA_RATES:
break;
case CFG_AP_MODE:
DBG_ERROR( DbgInfo, "set CFG_AP_MODE no longer supported\n" );
break;
case CFG_ENCRYPT_STRG:
memset( lp->szEncryption, 0, sizeof( lp->szEncryption ));
memcpy( (void *)lp->szEncryption, (void *)&pLtv->u.u8[0], ( pLtv->len * sizeof( hcf_16 )) );
wl_wep_decode( CRYPT_CODE, &sEncryption, lp->szEncryption );
lp->TransmitKeyID = sEncryption.wTxKeyID + 1;
lp->EnableEncryption = sEncryption.wEnabled;
memcpy( &lp->DefaultKeys, &sEncryption.EncStr, sizeof( CFG_DEFAULT_KEYS_STRCT ));
break;
case CFG_DRIVER_ENABLE:
lp->driverEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_WOLAS_ENABLE:
lp->wolasEnable = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_SET_WPA_AUTH_KEY_MGMT_SUITE:
lp->AuthKeyMgmtSuite = pLtv->u.u16[0];
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_DISASSOCIATE_ADDR:
pLtv->u.u16[ETH_ALEN / 2] = CNV_T_TO_LITTLE( pLtv->u.u16[ETH_ALEN / 2] );
break;
case CFG_ADD_TKIP_DEFAULT_KEY:
case CFG_REMOVE_TKIP_DEFAULT_KEY:
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
case CFG_ADD_TKIP_MAPPED_KEY:
break;
case CFG_REMOVE_TKIP_MAPPED_KEY:
break;
case CFG_MB_FO:
case CFG_IFB:
default:
break;
}
switch( pLtv->typ ) {
case CFG_CNF_PORT_TYPE:
case CFG_CNF_OWN_MAC_ADDR:
case CFG_CNF_OWN_CHANNEL:
case CFG_CNF_OWN_SSID:
case CFG_CNF_OWN_ATIM_WDOW:
case CFG_CNF_SYSTEM_SCALE:
case CFG_CNF_MAX_DATA_LEN:
case CFG_CNF_PM_ENABLED:
case CFG_CNF_MCAST_RX:
case CFG_CNF_MAX_SLEEP_DURATION:
case CFG_CNF_HOLDOVER_DURATION:
case CFG_CNF_OWN_NAME:
case CFG_CNF_LOAD_BALANCG:
case CFG_CNF_MEDIUM_DISTRIBUTION:
case CFG_CNF_TX_POW_LVL:
case CFG_CNF_CONNECTION_CNTL:
case CFG_CNF_OWN_DTIM_PERIOD:
case CFG_CNF_OWN_BEACON_TERVAL:
case CFG_CNF_WDS_ADDR1:
case CFG_CNF_WDS_ADDR2:
case CFG_CNF_WDS_ADDR3:
case CFG_CNF_WDS_ADDR4:
case CFG_CNF_WDS_ADDR5:
case CFG_CNF_WDS_ADDR6:
case CFG_CNF_MCAST_PM_BUF:
case CFG_CNF_REJECT_ANY:
case CFG_CNF_ENCRYPTION:
case CFG_CNF_AUTHENTICATION:
case CFG_CNF_EXCL_UNENCRYPTED:
case CFG_CNF_MCAST_RATE:
case CFG_CNF_TRA_BSS_RELAY:
case CFG_CNF_MICRO_WAVE:
case CFG_AP_MODE:
case CFG_ENCRYPT_STRG:
case CFG_WOLAS_ENABLE:
case CFG_MB_FO:
case CFG_IFB:
break;
case CFG_DRIVER_ENABLE:
if( lp->driverEnable ) {
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_ENABLE | HCF_PORT_0 );
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_CONNECT );
} else {
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISABLE | HCF_PORT_0 );
hcf_cntl( &( lp->hcfCtx ), HCF_CNTL_DISCONNECT );
}
break;
default:
wl_act_int_off( lp );
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on( lp );
break;
}
if( ltvAllocated ) {
kfree( pLtv );
}
} else {
urq->result = UIL_FAILURE;
}
} else {
DBG_ERROR( DbgInfo, "EPERM\n" );
urq->result = UIL_FAILURE;
result = -EPERM;
}
} else {
DBG_ERROR( DbgInfo, "UIL_ERR_WRONG_IFB\n" );
urq->result = UIL_ERR_WRONG_IFB;
}
DBG_LEAVE( DbgInfo );
return result;
}
|
int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) {
ENCSTRCT sEncryption;
hcf_16 hcfPort = HCF_PORT_0;
if (urq->hcfCtx == &(lp->hcfCtx)) {
if (capable(CAP_NET_ADM)) {
if ((urq->data != NULL) && (urq->len != 0)) {
switch (pLtv->typ) {
case CFG_CNF_OWN_NAME:
memset(lp->StationName, 0, sizeof(lp->StationName));
memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
}
switch (pLtv->typ) {
default:
wl_act_int_off(lp);
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on(lp);
break;
}
} else {
}
} else {
}
} else {
}
}
|
int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) {
ENCSTRCT sEncryption;
size_t len;
hcf_16 hcfPort = HCF_PORT_0;
if (urq->hcfCtx == &(lp->hcfCtx)) {
if (capable(CAP_NET_ADM)) {
if ((urq->data != NULL) && (urq->len != 0)) {
switch (pLtv->typ) {
case CFG_CNF_OWN_NAME:
memset(lp->StationName, 0, sizeof(lp->StationName));
len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
strlcpy(lp->StationName, &pLtv->u.u8[2], len);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
}
switch (pLtv->typ) {
default:
wl_act_int_off(lp);
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on(lp);
break;
}
} else {
}
} else {
}
} else {
}
}
|
int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
ENCSTRCT sEncryption;
hcf_16 hcfPort = HCF_PORT_0;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if( urq->hcfCtx == &( lp->hcfCtx )) {
if( capable( CAP_NET_ADM )) {
if(( urq->data != NULL ) && ( urq->len != 0 )) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
switch( pLtv->typ ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
case CFG_CNF_OWN_NAME:
memset( lp->StationName, 0, sizeof( lp->StationName ));
memcpy( (void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
switch( pLtv->typ ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
default:
wl_act_int_off( lp );
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on( lp );
break;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
ENCSTRCT sEncryption;
size_t len;
hcf_16 hcfPort = HCF_PORT_0;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
if( urq->hcfCtx == &( lp->hcfCtx )) {
if( capable( CAP_NET_ADM )) {
if(( urq->data != NULL ) && ( urq->len != 0 )) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
switch( pLtv->typ ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
case CFG_CNF_OWN_NAME:
memset( lp->StationName, 0, sizeof( lp->StationName ));
len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
strlcpy(lp->StationName, &pLtv->u.u8[2], len);
pLtv->u.u16[0] = CNV_T_TO_LITTLE( pLtv->u.u16[0] );
break;
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
switch( pLtv->typ ) {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
default:
wl_act_int_off( lp );
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on( lp );
break;
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
} else {
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
/* PLACEHOLDER: DO NOT DELETE THIS COMMENT */
}
|
int wvlan_uil_put_info(struct uilreq *urq, struct wl_private *lp) {
ENCSTRCT sEncryption;
+ size_t len;
hcf_16 hcfPort = HCF_PORT_0;
if (urq->hcfCtx == &(lp->hcfCtx)) {
if (capable(CAP_NET_ADM)) {
if ((urq->data != NULL) && (urq->len != 0)) {
switch (pLtv->typ) {
case CFG_CNF_OWN_NAME:
memset(lp->StationName, 0, sizeof(lp->StationName));
- memcpy((void *)lp->StationName, (void *)&pLtv->u.u8[2], (size_t)pLtv->u.u16[0]);
+ len = min_t(size_t, pLtv->u.u16[0], sizeof(lp->StationName));
+ strlcpy(lp->StationName, &pLtv->u.u8[2], len);
pLtv->u.u16[0] = CNV_T_TO_LITTLE(pLtv->u.u16[0]);
break;
}
switch (pLtv->typ) {
default:
wl_act_int_off(lp);
urq->result = hcf_put_info(&(lp->hcfCtx), (LTVP) pLtv);
wl_act_int_on(lp);
break;
}
} else {
}
} else {
}
} else {
}
}
|
End of preview. Expand
in Data Studio
README.md exists but content is empty.
- Downloads last month
- 17