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
4 changes: 1 addition & 3 deletions drivers/infiniband/core/umem_dmabuf.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,11 @@ struct ib_umem_dmabuf *ib_umem_dmabuf_get_pinned(struct ib_device *device,

err = ib_umem_dmabuf_map_pages(umem_dmabuf);
if (err)
goto err_unpin;
goto err_release;
dma_resv_unlock(umem_dmabuf->attach->dmabuf->resv);

return umem_dmabuf;

err_unpin:
dma_buf_unpin(umem_dmabuf->attach);
err_release:
dma_resv_unlock(umem_dmabuf->attach->dmabuf->resv);
ib_umem_release(&umem_dmabuf->umem);
Expand Down
2 changes: 1 addition & 1 deletion drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ int pvrdma_alloc_ucontext(struct ib_ucontext *uctx, struct ib_udata *udata)
uresp.qp_tab_size = vdev->dsr->caps.max_qp;
ret = ib_copy_to_udata(udata, &uresp, sizeof(uresp));
if (ret) {
pvrdma_uar_free(vdev, &context->uar);
/* pvrdma_dealloc_ucontext() also frees the UAR */
pvrdma_dealloc_ucontext(&context->ibucontext);
return -EFAULT;
}
Expand Down
13 changes: 7 additions & 6 deletions drivers/net/ethernet/mellanox/mlx4/srq.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,14 @@ void mlx4_srq_event(struct mlx4_dev *dev, u32 srqn, int event_type)
{
struct mlx4_srq_table *srq_table = &mlx4_priv(dev)->srq_table;
struct mlx4_srq *srq;
unsigned long flags;

rcu_read_lock();
spin_lock_irqsave(&srq_table->lock, flags);
srq = radix_tree_lookup(&srq_table->tree, srqn & (dev->caps.num_srqs - 1));
rcu_read_unlock();
if (srq)
refcount_inc(&srq->refcount);
else {
if (!srq || !refcount_inc_not_zero(&srq->refcount))
srq = NULL;
spin_unlock_irqrestore(&srq_table->lock, flags);
if (!srq) {
mlx4_warn(dev, "Async event for bogus SRQ %08x\n", srqn);
return;
}
Expand Down Expand Up @@ -203,8 +204,8 @@ int mlx4_srq_alloc(struct mlx4_dev *dev, u32 pdn, u32 cqn, u16 xrcd,
if (err)
goto err_radix;

refcount_set(&srq->refcount, 1);
init_completion(&srq->free);
atomic_set_release(&srq->refcount.refs, 1);

return 0;

Expand Down
1 change: 1 addition & 0 deletions include/net/bluetooth/bluetooth.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ int bt_sock_register(int proto, const struct net_proto_family *ops);
void bt_sock_unregister(int proto);
void bt_sock_link(struct bt_sock_list *l, struct sock *s);
void bt_sock_unlink(struct bt_sock_list *l, struct sock *s);
bool bt_sock_linked(struct bt_sock_list *l, struct sock *s);
int bt_sock_recvmsg(struct socket *sock, struct msghdr *msg, size_t len,
int flags);
int bt_sock_stream_recvmsg(struct socket *sock, struct msghdr *msg,
Expand Down
1 change: 1 addition & 0 deletions kernel/exit.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,7 @@ void __noreturn make_task_dead(int signr)
futex_exit_recursive(tsk);
tsk->exit_state = EXIT_DEAD;
refcount_inc(&tsk->rcu_users);
preempt_disable();
do_task_dead();
}

Expand Down
22 changes: 22 additions & 0 deletions net/bluetooth/af_bluetooth.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,28 @@ void bt_sock_unlink(struct bt_sock_list *l, struct sock *sk)
}
EXPORT_SYMBOL(bt_sock_unlink);

bool bt_sock_linked(struct bt_sock_list *l, struct sock *s)
{
struct sock *sk;

if (!l || !s)
return false;

read_lock(&l->lock);

sk_for_each(sk, &l->head) {
if (s == sk) {
read_unlock(&l->lock);
return true;
}
}

read_unlock(&l->lock);

return false;
}
EXPORT_SYMBOL(bt_sock_linked);

void bt_accept_enqueue(struct sock *parent, struct sock *sk, bool bh)
{
BT_DBG("parent %p, sk %p", parent, sk);
Expand Down
32 changes: 23 additions & 9 deletions net/bluetooth/sco.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,28 @@ struct sco_pinfo {
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)

static struct sock *sco_sock_hold(struct sco_conn *conn)
{
if (!conn || !bt_sock_linked(&sco_sk_list, conn->sk))
return NULL;

sock_hold(conn->sk);

return conn->sk;
}

static void sco_sock_timeout(struct work_struct *work)
{
struct sco_conn *conn = container_of(work, struct sco_conn,
timeout_work.work);
struct sock *sk;

sco_conn_lock(conn);
sk = conn->sk;
if (sk)
sock_hold(sk);
if (!conn->hcon) {
sco_conn_unlock(conn);
return;
}
sk = sco_sock_hold(conn);
sco_conn_unlock(conn);

if (!sk)
Expand Down Expand Up @@ -188,9 +200,7 @@ static void sco_conn_del(struct hci_conn *hcon, int err)

/* Kill socket */
sco_conn_lock(conn);
sk = conn->sk;
if (sk)
sock_hold(sk);
sk = sco_sock_hold(conn);
sco_conn_unlock(conn);

if (sk) {
Expand Down Expand Up @@ -302,7 +312,7 @@ static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb)
struct sock *sk;

sco_conn_lock(conn);
sk = conn->sk;
sk = sco_sock_hold(conn);
sco_conn_unlock(conn);

if (!sk)
Expand All @@ -311,11 +321,15 @@ static void sco_recv_frame(struct sco_conn *conn, struct sk_buff *skb)
BT_DBG("sk %p len %u", sk, skb->len);

if (sk->sk_state != BT_CONNECTED)
goto drop;
goto drop_put;

if (!sock_queue_rcv_skb(sk, skb))
if (!sock_queue_rcv_skb(sk, skb)) {
sock_put(sk);
return;
}

drop_put:
sock_put(sk);
drop:
kfree_skb(skb);
}
Expand Down
Loading
Loading