[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <edd3f6af-98eb-2f17-2144-99daf6455be8@huawei.com>
Date: Wed, 3 Aug 2022 16:56:44 +0800
From: Li Jinlin <lijinlin3@...wei.com>
To: Mike Christie <michael.christie@...cle.com>,
"lduncan@...e.com" <lduncan@...e.com>,
"cleech@...hat.com" <cleech@...hat.com>,
"jejb@...ux.ibm.com" <jejb@...ux.ibm.com>,
"martin.petersen@...cle.com" <martin.petersen@...cle.com>,
"mark.mielke@...il.com" <mark.mielke@...il.com>
CC: "open-iscsi@...glegroups.com" <open-iscsi@...glegroups.com>,
"linux-scsi@...r.kernel.org" <linux-scsi@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
linfeilong <linfeilong@...wei.com>,
"liuzhiqiang (I)" <liuzhiqiang26@...wei.com>
Subject: Re: [PATCH] scsi: iscsi: iscsi_tcp: Fix null-ptr-deref while calling
getpeername()
On 8/3/2022 12:25 AM, Mike Christie wrote:
> On 8/2/22 6:23 AM, lijinlin (A) wrote:
>> So sorry, this patch has problem, please ignore.
>>
>
> Was the issue the fget use?
>> I know I gave the suggestion to do the get, but seeing it now makes
> me think I was wrong and it's getting too messy.
>
I use get_file() in local, and test the patch can fix this null-ptr-deref.
But I got an INFO report as below, it only appears once in multiple
tests. I'm not sure if this info report represents a possible problem
with the patch. So I ask for ignore it.
INFO: trying to register non-static key.
The code is fine but needs lockdep annotation, or maybe
you didn't initialize this object before use?
turning off the locking correctness validator.
CPU: 21 PID: 1074 Comm: cat Not tainted 5.19.0 #44
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014
Call Trace:
<TASK>
dump_stack_lvl+0x49/0x63
dump_stack+0x10/0x16
register_lock_class+0x483/0x490
? reacquire_held_locks+0xcb/0x1e0
? release_sock+0x1e/0xb0
__lock_acquire.constprop.0+0x4e/0x530
? lock_release+0x142/0x2d0
lock_acquire+0xc3/0x1b0
? iscsi_sw_tcp_host_get_param+0xa4/0x120
_raw_spin_lock_bh+0x34/0x50
? iscsi_sw_tcp_host_get_param+0xa4/0x120
iscsi_sw_tcp_host_get_param+0xa4/0x120
show_host_param_ISCSI_HOST_PARAM_IPADDRESS+0x56/0x70
dev_attr_show+0x1d/0x50
sysfs_kf_seq_show+0xad/0x120
kernfs_seq_show+0x2c/0x40
seq_read_iter+0x12e/0x4d0
? aa_file_perm+0x177/0x5a0
kernfs_fop_read_iter+0x183/0x210
new_sync_read+0xfe/0x180
? 0xffffffff81000000
vfs_read+0x14d/0x1a0
ksys_read+0x6d/0xf0
__x64_sys_read+0x1a/0x20
do_syscall_64+0x3b/0x90
entry_SYSCALL_64_after_hwframe+0x63/0xcd
> Let's just add a mutex for getting/setting the tcp_sw_conn->sock in
> the non-io paths (io paths are flushed/locked already). Something like
> this (patch is only compile tested):
>
This patch is clean, I have tested it and it is effective.
Please push this patch to the mainline, Thanks.
Jinlin
> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
> index 9fee70d6434a..c1696472965e 100644
> --- a/drivers/scsi/iscsi_tcp.c
> +++ b/drivers/scsi/iscsi_tcp.c
Powered by blists - more mailing lists