mirror of
https://github.com/lkl/linux.git
synced 2025-12-19 16:13:19 +09:00
[SCSI] iscsi_ibft, be2iscsi, iscsi_boot: fix boot kobj data lifetime management
be2iscsi passes the boot functions its phba object which is allocated in the shost, but iscsi_ibft passes in a object allocated for each item to display. The problem is that iscsi_boot_sysfs was managing the lifetime of the object passed in and doing a kfree on release. This causes a double free for be2iscsi which frees the shost in its pci_remove. This patch fixes the problem by adding a release callback which the drivers can call kfree or a put() type of function (needed for be2iscsi which will do a get/put on the shost). Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
This commit is contained in:
committed by
James Bottomley
parent
9d04516310
commit
f457a46f17
@@ -92,6 +92,13 @@ struct iscsi_boot_kobj {
|
||||
* properties.
|
||||
*/
|
||||
mode_t (*is_visible) (void *data, int type);
|
||||
|
||||
/*
|
||||
* Driver specific release function.
|
||||
*
|
||||
* The function should free the data passed in.
|
||||
*/
|
||||
void (*release) (void *data);
|
||||
};
|
||||
|
||||
struct iscsi_boot_kset {
|
||||
@@ -103,18 +110,21 @@ struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_initiator(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type));
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
|
||||
struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_ethernet(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type));
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
struct iscsi_boot_kobj *
|
||||
iscsi_boot_create_target(struct iscsi_boot_kset *boot_kset, int index,
|
||||
void *data,
|
||||
ssize_t (*show) (void *data, int type, char *buf),
|
||||
mode_t (*is_visible) (void *data, int type));
|
||||
mode_t (*is_visible) (void *data, int type),
|
||||
void (*release) (void *data));
|
||||
|
||||
struct iscsi_boot_kset *iscsi_boot_create_kset(const char *set_name);
|
||||
struct iscsi_boot_kset *iscsi_boot_create_host_kset(unsigned int hostno);
|
||||
|
||||
Reference in New Issue
Block a user