Patch "net/sun3_82586: Avoid reading past buffer in debug output" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/sun3_82586: Avoid reading past buffer in debug output

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-sun3_82586-avoid-reading-past-buffer-in-debug-ou.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c90114e73df4072e96311d7bd10076579a275791
Author: Kees Cook <kees@xxxxxxxxxx>
Date:   Tue Feb 6 08:16:54 2024 -0800

    net/sun3_82586: Avoid reading past buffer in debug output
    
    [ Upstream commit 4bea747f3fbec33c16d369b2f51e55981d7c78d0 ]
    
    Since NUM_XMIT_BUFFS is always 1, building m68k with sun3_defconfig and
    -Warraybounds, this build warning is visible[1]:
    
    drivers/net/ethernet/i825xx/sun3_82586.c: In function 'sun3_82586_timeout':
    drivers/net/ethernet/i825xx/sun3_82586.c:990:122: warning: array subscript 1 is above array bounds of 'volatile struct transmit_cmd_struct *[1]' [-Warray-bounds=]
      990 |                 printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
          |                                                                                                               ~~~~~~~~~~~~^~~
    ...
    drivers/net/ethernet/i825xx/sun3_82586.c:156:46: note: while referencing 'xmit_cmds'
      156 |         volatile struct transmit_cmd_struct *xmit_cmds[NUM_XMIT_BUFFS];
    
    Avoid accessing index 1 since it doesn't exist.
    
    Link: https://github.com/KSPP/linux/issues/325 [1]
    Cc: Sam Creasey <sammy@xxxxxxxxx>
    Signed-off-by: Kees Cook <keescook@xxxxxxxxxxxx>
    Reviewed-by: Simon Horman <horms@xxxxxxxxxx>
    Tested-by: Simon Horman <horms@xxxxxxxxxx> # build-tested
    Reviewed-by: Gustavo A. R. Silva <gustavoars@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240206161651.work.876-kees@xxxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/i825xx/sun3_82586.c b/drivers/net/ethernet/i825xx/sun3_82586.c
index 1a86184d44c0a..e0c9fee4e1e65 100644
--- a/drivers/net/ethernet/i825xx/sun3_82586.c
+++ b/drivers/net/ethernet/i825xx/sun3_82586.c
@@ -990,7 +990,7 @@ static void sun3_82586_timeout(struct net_device *dev)
 	{
 #ifdef DEBUG
 		printk("%s: xmitter timed out, try to restart! stat: %02x\n",dev->name,p->scb->cus);
-		printk("%s: command-stats: %04x %04x\n",dev->name,swab16(p->xmit_cmds[0]->cmd_status),swab16(p->xmit_cmds[1]->cmd_status));
+		printk("%s: command-stats: %04x\n", dev->name, swab16(p->xmit_cmds[0]->cmd_status));
 		printk("%s: check, whether you set the right interrupt number!\n",dev->name);
 #endif
 		sun3_82586_close(dev);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux