Re: [PATCH V2] rxe: Fix a sleep-in-atomic bug in post_one_send

From: kbuild test robot
Date: Thu Jun 01 2017 - 05:29:47 EST


Hi Jia-Ju,

[auto build test WARNING on rdma/master]
[also build test WARNING on v4.12-rc3 next-20170601]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url: https://github.com/0day-ci/linux/commits/Jia-Ju-Bai/rxe-Fix-a-sleep-in-atomic-bug-in-post_one_send/20170601-160036
base: https://git.kernel.org/pub/scm/linux/kernel/git/dledford/rdma.git master
config: i386-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=i386

All warnings (new ones prefixed by >>):

drivers/infiniband/sw/rxe/rxe_verbs.c: In function 'init_send_wqe':
>> drivers/infiniband/sw/rxe/rxe_verbs.c:743:4: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
if (qp->is_user && copy_from_user(p, (__user void *)
^~
drivers/infiniband/sw/rxe/rxe_verbs.c:746:5: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the 'if'
err = copy_from_user(p, (__user void *)
^~~

vim +/if +743 drivers/infiniband/sw/rxe/rxe_verbs.c

8700e3e7 Moni Shoua 2016-06-16 727 struct ib_sge *sge;
773c8e53 Jia-Ju Bai 2017-06-01 728 int i, err;
8700e3e7 Moni Shoua 2016-06-16 729 u8 *p;
8700e3e7 Moni Shoua 2016-06-16 730
8700e3e7 Moni Shoua 2016-06-16 731 init_send_wr(qp, &wqe->wr, ibwr);
8700e3e7 Moni Shoua 2016-06-16 732
8700e3e7 Moni Shoua 2016-06-16 733 if (qp_type(qp) == IB_QPT_UD ||
8700e3e7 Moni Shoua 2016-06-16 734 qp_type(qp) == IB_QPT_SMI ||
8700e3e7 Moni Shoua 2016-06-16 735 qp_type(qp) == IB_QPT_GSI)
8700e3e7 Moni Shoua 2016-06-16 736 memcpy(&wqe->av, &to_rah(ud_wr(ibwr)->ah)->av, sizeof(wqe->av));
8700e3e7 Moni Shoua 2016-06-16 737
8700e3e7 Moni Shoua 2016-06-16 738 if (unlikely(ibwr->send_flags & IB_SEND_INLINE)) {
8700e3e7 Moni Shoua 2016-06-16 739 p = wqe->dma.inline_data;
8700e3e7 Moni Shoua 2016-06-16 740
8700e3e7 Moni Shoua 2016-06-16 741 sge = ibwr->sg_list;
8700e3e7 Moni Shoua 2016-06-16 742 for (i = 0; i < num_sge; i++, sge++) {
8700e3e7 Moni Shoua 2016-06-16 @743 if (qp->is_user && copy_from_user(p, (__user void *)
8700e3e7 Moni Shoua 2016-06-16 744 (uintptr_t)sge->addr, sge->length))
773c8e53 Jia-Ju Bai 2017-06-01 745 spin_unlock_irqrestore(&qp->sq.sq_lock, *flags);
773c8e53 Jia-Ju Bai 2017-06-01 746 err = copy_from_user(p, (__user void *)
773c8e53 Jia-Ju Bai 2017-06-01 747 (uintptr_t)sge->addr, sge->length);
773c8e53 Jia-Ju Bai 2017-06-01 748 spin_lock_irqsave(&qp->sq.sq_lock, *flags);
773c8e53 Jia-Ju Bai 2017-06-01 749 if (qp->is_user && err)
8700e3e7 Moni Shoua 2016-06-16 750 return -EFAULT;
8700e3e7 Moni Shoua 2016-06-16 751

:::::: The code at line 743 was first introduced by commit
:::::: 8700e3e7c4857d28ebaa824509934556da0b3e76 Soft RoCE driver

:::::: TO: Moni Shoua <monis@xxxxxxxxxxxx>
:::::: CC: Doug Ledford <dledford@xxxxxxxxxx>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation

Attachment: .config.gz
Description: application/gzip