From: Ishai Rabinovitz Date: Thu, 29 Jun 2006 13:39:54 +0000 (+0300) Subject: [SCSI] sg.c: Fix bad error handling in X-Git-Tag: v2.6.18-rc1~22^2^2~7 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=454e8957eb60841016deb319dbbf83042fb32a39;p=pandora-kernel.git [SCSI] sg.c: Fix bad error handling in I got a NULL derefrence in cdev_del+1 when called from sg_remove. By looking at the code of sg_add, sg_alloc and sg_remove (all in drivers/scsi/sg.c) I found out that sg_add is calling sg_alloc but if it fails afterwards it does not deallocate the space that was allocated in sg_alloc and the redundant entry has NULL in cdev. When sg_remove is being called, it tries to perform cdev_del to this NULL cdev and fails. Signed-off-by: Ishai Rabinovitz Acked-by: Douglas Gilbert Signed-off-by: James Bottomley --- Reading git-diff-tree failed