Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754166AbYCLPJQ (ORCPT ); Wed, 12 Mar 2008 11:09:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751804AbYCLPJA (ORCPT ); Wed, 12 Mar 2008 11:09:00 -0400 Received: from iolanthe.rowland.org ([192.131.102.54]:49305 "HELO iolanthe.rowland.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with SMTP id S1751783AbYCLPI7 (ORCPT ); Wed, 12 Mar 2008 11:08:59 -0400 Date: Wed, 12 Mar 2008 11:08:57 -0400 (EDT) From: Alan Stern X-X-Sender: stern@iolanthe.rowland.org To: Boaz Harrosh cc: James Bottomley , Matthew Dharm , Sven Schnelle , , linux-scsi , FUJITA Tomonori , Andrew Morton Subject: Re: [PATCH] [SCSI] gdth: Allocate sense_buffer to prevent NULL pointer dereference In-Reply-To: <47D7D580.5060406@panasas.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1785 Lines: 49 On Wed, 12 Mar 2008, Boaz Harrosh wrote: > OK Now I see isd200_ata_command() is called from a usb.c internal thread. > > What I need to do is call scsi_get_command(scsi_device*) on first invocation. Why? > Now for the call to scsi_put_command()? At the time of the call to > isd200_free_info_ptrs() do you think I still have a valid scsi_device at this point? Definitely not. > What I will do is this. I will resend my original patch with your comments > fixed. This is for the 2.6.25-rc. And I will send another patch that uses > the proper scsi_get/put_command() for testing and inclusion into the 2.6.26 kernel. > Please ACK on the patch Okay. > > Yes. The three lines of code there are unnecessary. You should remove > > them (and the comment) instead of adding more somewhere else. Or if > > you want to keep them, just add a line to kfree(us->extra) before > > us->extra is set to NULL. > > How are they unnecessary? who will free them? other wise they will only be > freed at the very end. That's what I meant. > And that is only because usb_stor_transparent_scsi_command() > does not need any us->extra of it's own. But if ever it will, then this code > buried here will become a leak. Any additional resources needed by the transparent-SCSI handler will be added directly into the main us_data structure; they won't be part of us->extra. That hook was meant specifically for use by the nonstandard subdrivers. But on the whole you are right, and I agree with the change in your follow-up patch. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/