mirror of
https://github.com/SCST-project/scst.git
synced 2026-05-22 05:01:27 +00:00
scst, procfs: Avoid that adding a device to a group triggers a kernel oops
This patch fixes the following kernel oops: BUG: unable to handle kernel NULL pointer dereference at 0000000000000178 IP: [<ffffffffa031bbc8>] scst_acg_add_lun+0x178/0x300 [scst] Oops: 0000 [#1] PREEMPT SMP CPU: 3 PID: 7451 Comm: scstadmin Tainted: G O 3.13.0-rc3-debug+ #1 Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011 RIP: 0010:[<ffffffffa031bbc8>] [<ffffffffa031bbc8>] scst_acg_add_lun+0x178/0x300 [scst] Call Trace: [<ffffffffa03222cf>] scst_proc_groups_devices_write+0x78f/0x890 [scst] [<ffffffff8119dad8>] proc_reg_write+0x38/0x70 [<ffffffff81141562>] vfs_write+0xb2/0x1f0 [<ffffffff81141c57>] SyS_write+0x47/0xa0 [<ffffffff814efdb9>] system_call_fastpath+0x16/0x1b Code: 00 00 48 8b 4d b8 49 c7 c1 80 5a 34 a0 41 b8 ce 0d 00 00 48 8b 3d c1 15 03 00 48 c7 c2 42 ba 33 a0 48 c7 c6 31 ba 33 a0 48 8b 01 <48> 8b 80 78 01 00 00 48 89 44 24 20 8b 45 a4 89 44 24 18 48 8b RIP [<ffffffffa031bbc8>] scst_acg_add_lun+0x178/0x300 [scst] RSP <ffff88001f4a9de8> CR2: 0000000000000178 This regression was introduced in commit "Small logging improvement" (trunk r4838; 2013-04-12). Signed-off-by: Sebastian Herbszt <herbszt@gmx.de> git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@5198 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
@@ -3548,7 +3548,7 @@ int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent,
|
||||
|
||||
PRINT_INFO("Added device %s to group %s (LUN %lld, "
|
||||
"rd_only %d) to target %s", dev->virt_name, acg->acg_name,
|
||||
(long long unsigned int)lun, read_only, acg->tgt->tgt_name);
|
||||
lun, read_only, acg->tgt ? acg->tgt->tgt_name : "?");
|
||||
|
||||
if (out_acg_dev != NULL)
|
||||
*out_acg_dev = acg_dev;
|
||||
@@ -3600,7 +3600,7 @@ int scst_acg_del_lun(struct scst_acg *acg, uint64_t lun,
|
||||
scst_report_luns_changed(acg);
|
||||
|
||||
PRINT_INFO("Removed LUN %lld from group %s (target %s)",
|
||||
(unsigned long long)lun, acg->acg_name, acg->tgt->tgt_name);
|
||||
lun, acg->acg_name, acg->tgt ? acg->tgt->tgt_name : "?");
|
||||
|
||||
out:
|
||||
TRACE_EXIT_RES(res);
|
||||
@@ -4390,7 +4390,7 @@ int scst_acg_add_acn(struct scst_acg *acg, const char *name)
|
||||
out:
|
||||
if (res == 0) {
|
||||
PRINT_INFO("Added name %s to group %s (target %s)", name,
|
||||
acg->acg_name, acg->tgt->tgt_name);
|
||||
acg->acg_name, acg->tgt ? acg->tgt->tgt_name : "?");
|
||||
scst_check_reassign_sessions();
|
||||
}
|
||||
|
||||
@@ -4464,7 +4464,7 @@ int scst_acg_remove_name(struct scst_acg *acg, const char *name, bool reassign)
|
||||
|
||||
if (res == 0) {
|
||||
PRINT_INFO("Removed name %s from group %s (target %s)", name,
|
||||
acg->acg_name, acg->tgt->tgt_name);
|
||||
acg->acg_name, acg->tgt ? acg->tgt->tgt_name : "?");
|
||||
if (reassign)
|
||||
scst_check_reassign_sessions();
|
||||
} else
|
||||
|
||||
Reference in New Issue
Block a user