From: Joachim Fenkes <fenkes-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
To: Tziporet Koren
<tziporet-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
Vladimir Sokolovsky
<vlad-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
Amir Vadai <amirv-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org>,
Linux-RDMA <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
OF-EWG <ewg@l>
Cc: Alexander Schmidt
<alexs-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>,
Christoph Raisch <raisch-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
Hoang-Nam Nguyen
<hnguyen-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>,
Stefan Roscher
<stefan.roscher-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
Subject: [PATCH] sdp: Prevent kernel crash if device init fails (plus bonus fix)
Date: Mon, 22 Feb 2010 18:06:56 +0100 [thread overview]
Message-ID: <201002221806.56390.fenkes@de.ibm.com> (raw)
If sdp_add_device() fails, there is no client data stored in the IB device,
leading to a kernel crash when a connection is being established. Fix this
by rejecting connections when the device is not initialized.
Also, fix a bad goto target in an error case early in sdp_init_qp().
Signed-off-by: Joachim Fenkes <fenkes-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
---
kernel_patches/fixes/sdp-0001-fix-error-path.patch | 38 ++++++++++++++++++++
1 files changed, 38 insertions(+), 0 deletions(-)
create mode 100644 kernel_patches/fixes/sdp-0001-fix-error-path.patch
diff --git a/kernel_patches/fixes/sdp-0001-fix-error-path.patch b/kernel_patches/fixes/sdp-0001-fix-error-path.patch
new file mode 100644
index 0000000..5a5f784
--- /dev/null
+++ b/kernel_patches/fixes/sdp-0001-fix-error-path.patch
@@ -0,0 +1,38 @@
+[PATCH] sdp: Prevent kernel crash if device init fails (plus bonus fix)
+
+If sdp_add_device() fails, there is no client data stored in the IB device,
+leading to a kernel crash when a connection is being established. Fix this
+by rejecting connections when the device is not initialized.
+
+Also, fix a bad goto target in an error case early in sdp_init_qp().
+
+Signed-off-by: Joachim Fenkes <fenkes-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org>
+
+---
+
+ sdp_cma.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff -urp a/drivers/infiniband/ulp/sdp/sdp_cma.c b/drivers/infiniband/ulp/sdp/sdp_cma.c
+--- a/drivers/infiniband/ulp/sdp/sdp_cma.c 2010-02-19 15:39:32.000000000 +0100
++++ b/drivers/infiniband/ulp/sdp/sdp_cma.c 2010-02-19 15:38:13.000000000 +0100
+@@ -94,13 +94,18 @@ static int sdp_init_qp(struct sock *sk,
+ sdp_warn(sk, "recv sge's. capability: %d needed: %ld\n",
+ sdp_sk(sk)->max_sge, SDP_MAX_RECV_SKB_FRAGS + 1);
+ rc = -ENOMEM;
+- goto err_tx;
++ goto err_rx;
+ }
+
+ qp_init_attr.cap.max_send_sge = sdp_sk(sk)->max_sge;
+ sdp_dbg(sk, "Setting max send sge to: %d\n", sdp_sk(sk)->max_sge);
+
+ sdp_sk(sk)->sdp_dev = ib_get_client_data(device, &sdp_client);
++ if (!sdp_sk(sk)->sdp_dev) {
++ sdp_warn(sk, "SDP not available on device %s", device->name);
++ rc = -ENODEV;
++ goto err_rx;
++ }
+
+ rc = sdp_rx_ring_create(sdp_sk(sk), device);
+ if (rc)
--
1.7.0
--
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
reply other threads:[~2010-02-22 17:06 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=201002221806.56390.fenkes@de.ibm.com \
--to=fenkes-ta70fqpds9bqt0dzr+alfa@public.gmane.org \
--cc=alexs-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \
--cc=amirv-VPRAkNaXOzVS1MOuV/RT9w@public.gmane.org \
--cc=ewg@l \
--cc=hnguyen-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=raisch-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
--cc=stefan.roscher-tA70FqPdS9bQT0dZR+AlfA@public.gmane.org \
--cc=tziporet-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=vlad-VPRAkNaXOzVS1MOuV/RT9w@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