diff mbox series

[net] s390/qeth: fix use-after-free in hsci

Message ID 20221206145614.1401170-1-wintera@linux.ibm.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net] s390/qeth: fix use-after-free in hsci | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/fixes_present success Fixes tag present in non-next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers fail 1 blamed authors not CCed: kgraul@linux.ibm.com; 5 maintainers not CCed: agordeev@linux.ibm.com kgraul@linux.ibm.com gor@linux.ibm.com borntraeger@linux.ibm.com svens@linux.ibm.com
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 14 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Alexandra Winter Dec. 6, 2022, 2:56 p.m. UTC
KASAN found that addr was dereferenced after br2dev_event_work was freed.

Fixes: f7936b7b2663 ("s390/qeth: Update MACs of LEARNING_SYNC device")
Reported-by: Thorsten Winkler <twinkler@linux.ibm.com>
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
Reviewed-by: Thorsten Winkler <twinkler@linux.ibm.com>
---
 drivers/s390/net/qeth_l2_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Leon Romanovsky Dec. 7, 2022, 8:36 a.m. UTC | #1
On Tue, Dec 06, 2022 at 03:56:14PM +0100, Alexandra Winter wrote:
> KASAN found that addr was dereferenced after br2dev_event_work was freed.

Please add KASAN report to be part of commit message.

Thanks

> 
> Fixes: f7936b7b2663 ("s390/qeth: Update MACs of LEARNING_SYNC device")
> Reported-by: Thorsten Winkler <twinkler@linux.ibm.com>
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
> Reviewed-by: Wenjia Zhang <wenjia@linux.ibm.com>
> Reviewed-by: Thorsten Winkler <twinkler@linux.ibm.com>
> ---
>  drivers/s390/net/qeth_l2_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
> index 9dc935886e9f..c6ded3fdd715 100644
> --- a/drivers/s390/net/qeth_l2_main.c
> +++ b/drivers/s390/net/qeth_l2_main.c
> @@ -758,7 +758,6 @@ static void qeth_l2_br2dev_worker(struct work_struct *work)
>  	struct list_head *iter;
>  	int err = 0;
>  
> -	kfree(br2dev_event_work);
>  	QETH_CARD_TEXT_(card, 4, "b2dw%04lx", event);
>  	QETH_CARD_TEXT_(card, 4, "ma%012llx", ether_addr_to_u64(addr));
>  
> @@ -815,6 +814,7 @@ static void qeth_l2_br2dev_worker(struct work_struct *work)
>  	dev_put(brdev);
>  	dev_put(lsyncdev);
>  	dev_put(dstdev);
> +	kfree(br2dev_event_work);
>  }
>  
>  static int qeth_l2_br2dev_queue_work(struct net_device *brdev,
> -- 
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/s390/net/qeth_l2_main.c b/drivers/s390/net/qeth_l2_main.c
index 9dc935886e9f..c6ded3fdd715 100644
--- a/drivers/s390/net/qeth_l2_main.c
+++ b/drivers/s390/net/qeth_l2_main.c
@@ -758,7 +758,6 @@  static void qeth_l2_br2dev_worker(struct work_struct *work)
 	struct list_head *iter;
 	int err = 0;
 
-	kfree(br2dev_event_work);
 	QETH_CARD_TEXT_(card, 4, "b2dw%04lx", event);
 	QETH_CARD_TEXT_(card, 4, "ma%012llx", ether_addr_to_u64(addr));
 
@@ -815,6 +814,7 @@  static void qeth_l2_br2dev_worker(struct work_struct *work)
 	dev_put(brdev);
 	dev_put(lsyncdev);
 	dev_put(dstdev);
+	kfree(br2dev_event_work);
 }
 
 static int qeth_l2_br2dev_queue_work(struct net_device *brdev,