Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752076AbdF3FxR (ORCPT ); Fri, 30 Jun 2017 01:53:17 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:58188 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751577AbdF3FxP (ORCPT ); Fri, 30 Jun 2017 01:53:15 -0400 Message-ID: <1498801985.24896.4.camel@haakon3.risingtidesystems.com> Subject: Re: [PATCH] ib_isert: prevent NULL pointer dereference in isert_login_recv_done() From: "Nicholas A. Bellinger" To: Sagi Grimberg Cc: Andrea Righi , Robert LeBlanc , Sean Jenkins , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma , target-devel , lkml , Christoph Hellwig Date: Thu, 29 Jun 2017 22:53:05 -0700 In-Reply-To: <7f1b1f07-0670-10ee-620d-0ab3b1a6c2bf@grimberg.me> References: <20170622223757.GC28955@Dell> <1498435084.26123.66.camel@haakon3.risingtidesystems.com> <20170628175354.GB1769@Dell> <20170629082057.GA2037@Dell> <7f1b1f07-0670-10ee-620d-0ab3b1a6c2bf@grimberg.me> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.4.4-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1291 Lines: 28 On Thu, 2017-06-29 at 11:28 +0300, Sagi Grimberg wrote: > >> Can you test just the one liner fix below? > >> > >>>> @@ -1452,7 +1452,7 @@ > >>>> isert_login_recv_done(struct ib_cq *cq, struct ib_wc *wc) > >>>> { > >>>> struct isert_conn *isert_conn = wc->qp->qp_context; > >>>> - struct ib_device *ib_dev = isert_conn->cm_id->device; > >>>> + struct ib_device *ib_dev = isert_conn->device->ib_device; > >>>> if (unlikely(wc->status != IB_WC_SUCCESS)) { > >>>> isert_print_wc(wc, "login recv"); > > > > I'll test also this one-liner fix as soon as I can. > > > > But I can say that I'm pretty sure it will work as well, because all the > > previous NULL pointer dereferences that we've got in the past happened > > all 100% in isert_login_recv_done(). The other cases are probably a safe > > precaution, but they can't really happen. > > Agree, I'd prefer to start with a surgical fix before moving forward. Sounds fine. The single line fix above in isert_login_recv_done() has been queued up in target-pending/for-next with Andrea's Tested-by and your Reviewed-by: https://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=702c0f17403765cc5aa1c18f6ea6eb549c1bac9b Please let me know if there are any other issues wrt the surgical fix.