Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752347AbdF2IVQ (ORCPT ); Thu, 29 Jun 2017 04:21:16 -0400 Received: from mail-wm0-f48.google.com ([74.125.82.48]:35934 "EHLO mail-wm0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751678AbdF2IVC (ORCPT ); Thu, 29 Jun 2017 04:21:02 -0400 Date: Thu, 29 Jun 2017 10:20:57 +0200 From: Andrea Righi To: Sagi Grimberg Cc: "Nicholas A. Bellinger" , Robert LeBlanc , Sean Jenkins , Doug Ledford , Sean Hefty , Hal Rosenstock , linux-rdma , target-devel , lkml , Christoph Hellwig Subject: Re: [PATCH] ib_isert: prevent NULL pointer dereference in isert_login_recv_done() Message-ID: <20170629082057.GA2037@Dell> References: <20170622223757.GC28955@Dell> <1498435084.26123.66.camel@haakon3.risingtidesystems.com> <20170628175354.GB1769@Dell> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1012 Lines: 26 On Thu, Jun 29, 2017 at 08:36:51AM +0300, Sagi Grimberg wrote: > > >Just tested this patch, I wasn't able to reproduce the NULL pointer > >dereference or any other bugs, so this fix seems safe enough to me. > > > >Tested-by: Andrea Righi > > 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. -Andrea