linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
To: Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>,
	Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>,
	Laurence Oberman
	<loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: [PATCH 09/11] IB/srp: Fix a NULL pointer dereference
Date: Fri, 22 Apr 2016 14:15:30 -0700	[thread overview]
Message-ID: <571A9472.5050202@sandisk.com> (raw)
In-Reply-To: <571A936F.7040409-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>

Avoid that running xfstests on top of the SRP initiator triggers
the call trace below. This patch has been tested by running the
following shell command on an initiator system that has access
to 3200 SRP LUNs:

/etc/init.d/multipathd start
while true; do
  /etc/init.d/srpd start
  sleep 400
  /etc/init.d/srpd stop
  for p in /sys/class/srp_remote_ports/*; do
    echo 1 >$p/delete &
  done
  wait
  dmsetup remove_all
done

BUG: unable to handle kernel NULL pointer dereference at           (null)
IP: [<ffffffffa0918bb1>] srp_claim_req+0x31/0x90 [ib_srp]
Call Trace:
 <IRQ>
 [<ffffffffa091c096>] srp_process_rsp+0xa6/0x2a0 [ib_srp]
 [<ffffffffa091c5ec>] srp_handle_recv+0x16c/0x340 [ib_srp]
 [<ffffffffa091c7f9>] srp_recv_completion+0x39/0x70 [ib_srp]
 [<ffffffffa0184442>] mlx4_ib_cq_comp+0x12/0x20 [mlx4_ib]
 [<ffffffffa005e86d>] mlx4_cq_completion+0x3d/0x80 [mlx4_core]
 [<ffffffffa006002b>] mlx4_eq_int+0x53b/0xd50 [mlx4_core]
 [<ffffffffa006084f>] mlx4_msi_x_interrupt+0xf/0x20 [mlx4_core]
 [<ffffffff810b67e0>] handle_irq_event_percpu+0x40/0x110
 [<ffffffff810b68ef>] handle_irq_event+0x3f/0x70
 [<ffffffff810ba829>] handle_edge_irq+0x79/0x120
 [<ffffffff81007f2d>] handle_irq+0x5d/0x130
 [<ffffffff810071ed>] do_IRQ+0x6d/0x130
 [<ffffffff8151c104>] common_interrupt+0x84/0x84
 <EOI>

Signed-off-by: Bart Van Assche <bart.vanassche-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
Cc: Christoph Hellwig <hch-jcswGhMUV9g@public.gmane.org>
Cc: Sagi Grimberg <sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
Cc: Laurence Oberman <loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
---
 drivers/infiniband/ulp/srp/ib_srp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index caefd1a..f4003f6 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -1814,7 +1814,8 @@ static void srp_process_rsp(struct srp_rdma_ch *ch, struct srp_rsp *rsp)
 		scmnd = scsi_host_find_tag(target->scsi_host, rsp->tag);
 		if (scmnd) {
 			req = (void *)scmnd->host_scribble;
-			scmnd = srp_claim_req(ch, req, NULL, scmnd);
+			scmnd = req ? srp_claim_req(ch, req, NULL, scmnd) :
+				NULL;
 		}
 		if (!scmnd) {
 			shost_printk(KERN_ERR, target->scsi_host,
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2016-04-22 21:15 UTC|newest]

Thread overview: 64+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-22 21:11 [PATCH 0/11] More SRP patches for kernel v4.7 Bart Van Assche
     [not found] ` <571A936F.7040409-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-22 21:12   ` [PATCH 01/11] IB/srp: Fix a spelling error in a source code comment Bart Van Assche
     [not found]     ` <571A93AA.9000605-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:26       ` Christoph Hellwig
2016-04-22 21:12   ` [PATCH 02/11] IB/srp: Fix a comment Bart Van Assche
     [not found]     ` <571A93CF.9050506-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 20:52       ` Sagi Grimberg
2016-05-03  9:26       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 03/11] IB/srp: Document srp_map_data() return value Bart Van Assche
     [not found]     ` <571A93E5.7030807-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:27       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 04/11] IB/srp: Fix srp_map_data() error paths Bart Van Assche
     [not found]     ` <571A93FF.8020102-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 20:53       ` Sagi Grimberg
2016-05-03  9:28       ` Christoph Hellwig
2016-04-22 21:13   ` [PATCH 05/11] IB/srp: Introduce target->mr_pool_size Bart Van Assche
     [not found]     ` <571A9415.4090002-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:28       ` Christoph Hellwig
2016-04-22 21:14   ` [PATCH 06/11] IB/srp: Avoid that mapping failure triggers an infinite loop Bart Van Assche
     [not found]     ` <571A9427.8010306-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:14   ` [PATCH 07/11] IB/srp: Move code out of a loop Bart Van Assche
     [not found]     ` <571A9443.6000600-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:00       ` Sagi Grimberg
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:15   ` [PATCH 08/11] IB/srp: Move common code into the caller Bart Van Assche
     [not found]     ` <571A9458.3050904-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:00       ` Sagi Grimberg
2016-05-03  9:29       ` Christoph Hellwig
2016-04-22 21:15   ` Bart Van Assche [this message]
     [not found]     ` <571A9472.5050202-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 21:04       ` [PATCH 09/11] IB/srp: Fix a NULL pointer dereference Sagi Grimberg
     [not found]         ` <571FD7F4.4090006-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-27  6:20           ` Leon Romanovsky
     [not found]             ` <20160427062053.GK7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-27 14:22               ` Bart Van Assche
2016-04-27 15:39               ` Bart Van Assche
2016-04-27 19:50           ` Bart Van Assche
2016-05-03  9:30       ` Christoph Hellwig
     [not found]         ` <20160503093032.GJ19931-jcswGhMUV9g@public.gmane.org>
2016-05-03 20:57           ` Bart Van Assche
     [not found]             ` <5729109E.6040500-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03 21:01               ` Laurence Oberman
2016-04-22 21:16   ` [PATCH 10/11] IB/srp: Do not register memory if register_always = -1 Bart Van Assche
     [not found]     ` <571A9490.9010003-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03  9:30       ` Christoph Hellwig
2016-04-22 21:16   ` [PATCH 11/11] IB/srp: Prevent mapping failures Bart Van Assche
     [not found]     ` <571A94AF.7000609-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-23 22:12       ` Laurence Oberman
2016-04-24  8:35       ` Leon Romanovsky
     [not found]         ` <20160424083538.GF7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-24 22:44           ` Laurence Oberman
2016-04-25  0:48           ` Bart Van Assche
     [not found]             ` <571D6975.2020905-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-25  5:54               ` Leon Romanovsky
     [not found]                 ` <20160425055433.GG7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-25  9:46                   ` Sagi Grimberg
     [not found]                     ` <571DE793.6090705-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-25 15:53                       ` Leon Romanovsky
     [not found]                         ` <20160425155320.GH7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-25 16:16                           ` Bart Van Assche
     [not found]                             ` <571E42D2.70705-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-04-26 14:12                               ` Leon Romanovsky
     [not found]                                 ` <20160426141229.GI7974-2ukJVAZIZ/Y@public.gmane.org>
2016-04-26 21:08                                   ` Sagi Grimberg
     [not found]                                     ` <571FD8D3.1060403-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org>
2016-04-26 23:10                                       ` Bart Van Assche
2016-04-26 21:06       ` Sagi Grimberg
2016-05-03  9:33       ` Christoph Hellwig
     [not found]         ` <20160503093307.GL19931-jcswGhMUV9g@public.gmane.org>
2016-05-03 21:13           ` Bart Van Assche
     [not found]             ` <5729147C.5000904-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-03 21:23               ` Laurence Oberman
2016-05-04  9:09               ` Christoph Hellwig
     [not found]                 ` <20160504090908.GA14787-jcswGhMUV9g@public.gmane.org>
2016-05-04 16:17                   ` Bart Van Assche
2016-05-04 23:44           ` Bart Van Assche
     [not found]             ` <572A8975.9060606-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 14:06               ` Christoph Hellwig
     [not found]                 ` <20160505140616.GA15000-jcswGhMUV9g@public.gmane.org>
2016-05-05 19:50                   ` Bart Van Assche
2016-05-05 19:58                   ` Laurence Oberman
     [not found]                     ` <2102017158.34060891.1462478304470.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 20:14                       ` Bart Van Assche
     [not found]                         ` <572BA98F.4090109-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 20:17                           ` Bart Van Assche
     [not found]                             ` <572BAA6F.1060607-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 20:55                               ` Laurence Oberman
     [not found]                                 ` <804753248.34153510.1462481756460.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 21:40                                   ` Bart Van Assche
     [not found]                                     ` <572BBDC0.5070205-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-05 22:01                                       ` Laurence Oberman
     [not found]                                         ` <1133135399.34245490.1462485666601.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 22:46                                           ` Bart Van Assche
     [not found]                                             ` <572BCD59.7010701-XdAiOPVOjttBDgjK7y7TUQ@public.gmane.org>
2016-05-09 22:50                                               ` Laurence Oberman
     [not found]                                                 ` <169904890.34764265.1462834206901.JavaMail.zimbra-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-09 22:55                                                   ` Bart Van Assche
2016-05-05 20:44   ` [PATCH 0/11] More SRP patches for kernel v4.7 Doug Ledford
     [not found]     ` <f406cd39-c6dc-d458-0ab0-c400fdd5b243-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-05-05 20:50       ` Bart Van Assche

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=571A9472.5050202@sandisk.com \
    --to=bart.vanassche-xdaiopvojttbdgjk7y7tuq@public.gmane.org \
    --cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=hch-jcswGhMUV9g@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=loberman-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=sagi-NQWnxTmZq1alnMjI0IkVqw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).