Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions drivers/infiniband/core/user_mad.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,8 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
struct ib_ah *ah;
struct ib_rmpp_mad *rmpp_mad;
__be64 *tid;
int ret, data_len, hdr_len, copy_offset, rmpp_active;
int ret, hdr_len, copy_offset, rmpp_active;
size_t data_len;
u8 base_version;

if (count < hdr_size(file) + IB_MGMT_RMPP_HDR)
Expand Down Expand Up @@ -574,7 +575,10 @@ static ssize_t ib_umad_write(struct file *filp, const char __user *buf,
}

base_version = ((struct ib_mad_hdr *)&packet->mad.data)->base_version;
data_len = count - hdr_size(file) - hdr_len;
if (check_sub_overflow(count, hdr_size(file) + hdr_len, &data_len)) {
ret = -EINVAL;
goto err_ah;
}
packet->msg = ib_create_send_mad(agent,
be32_to_cpu(packet->mad.hdr.qpn),
packet->mad.hdr.pkey_index, rmpp_active,
Expand Down
11 changes: 10 additions & 1 deletion net/can/raw.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,14 @@ static int raw_notifier(struct notifier_block *nb, unsigned long msg,
return NOTIFY_DONE;
}

static void raw_sock_destruct(struct sock *sk)
{
struct raw_sock *ro = raw_sk(sk);

free_percpu(ro->uniq);
can_sock_destruct(sk);
}

static int raw_init(struct sock *sk)
{
struct raw_sock *ro = raw_sk(sk);
Expand All @@ -353,6 +361,8 @@ static int raw_init(struct sock *sk)
if (unlikely(!ro->uniq))
return -ENOMEM;

sk->sk_destruct = raw_sock_destruct;

/* set notifier */
spin_lock(&raw_notifier_lock);
list_add_tail(&ro->notifier, &raw_notifier_list);
Expand Down Expand Up @@ -403,7 +413,6 @@ static int raw_release(struct socket *sock)
ro->ifindex = 0;
ro->bound = 0;
ro->count = 0;
free_percpu(ro->uniq);

sock_orphan(sk);
sock->sk = NULL;
Expand Down
Loading