Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752472AbdF2I2v (ORCPT ); Thu, 29 Jun 2017 04:28:51 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:35156 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752096AbdF2I2r (ORCPT ); Thu, 29 Jun 2017 04:28:47 -0400 Subject: Re: [PATCH] ib_isert: prevent NULL pointer dereference in isert_login_recv_done() To: Andrea Righi Cc: "Nicholas A. Bellinger" , Robert LeBlanc , Sean Jenkins , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma , target-devel , lkml , Christoph Hellwig References: <20170622223757.GC28955@Dell> <1498435084.26123.66.camel@haakon3.risingtidesystems.com> <20170628175354.GB1769@Dell> <20170629082057.GA2037@Dell> From: Sagi Grimberg Message-ID: <7f1b1f07-0670-10ee-620d-0ab3b1a6c2bf@grimberg.me> Date: Thu, 29 Jun 2017 11:28:40 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: <20170629082057.GA2037@Dell> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 831 Lines: 20 >> 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.