Patch "mctp: serial: Fix starting value for frame check sequence" has been added to the 6.1-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

    mctp: serial: Fix starting value for frame check sequence

to the 6.1-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:
     mctp-serial-fix-starting-value-for-frame-check-seque.patch
and it can be found in the queue-6.1 subdirectory.

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



commit d2c7c6eefc7d05e0061c203ea9bc799ddfa25bad
Author: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
Date:   Fri Dec 16 11:44:09 2022 +0800

    mctp: serial: Fix starting value for frame check sequence
    
    [ Upstream commit 2856a62762c8409e360d4fd452194c8e57ba1058 ]
    
    RFC1662 defines the start state for the crc16 FCS to be 0xffff, but
    we're currently starting at zero.
    
    This change uses the correct start state. We're only early in the
    adoption for the serial binding, so there aren't yet any other users to
    interface to.
    
    Fixes: a0c2ccd9b5ad ("mctp: Add MCTP-over-serial transport binding")
    Reported-by: Harsh Tyagi <harshtya@xxxxxxxxxx>
    Tested-by: Harsh Tyagi <harshtya@xxxxxxxxxx>
    Signed-off-by: Jeremy Kerr <jk@xxxxxxxxxxxxxxxxxxxx>
    Reviewed-by: Alexander Duyck <alexanderduyck@xxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/mctp/mctp-serial.c b/drivers/net/mctp/mctp-serial.c
index 7cd103fd34ef..9f9eaf896047 100644
--- a/drivers/net/mctp/mctp-serial.c
+++ b/drivers/net/mctp/mctp-serial.c
@@ -35,6 +35,8 @@
 #define BYTE_FRAME		0x7e
 #define BYTE_ESC		0x7d
 
+#define FCS_INIT		0xffff
+
 static DEFINE_IDA(mctp_serial_ida);
 
 enum mctp_serial_state {
@@ -123,7 +125,7 @@ static void mctp_serial_tx_work(struct work_struct *work)
 		buf[2] = dev->txlen;
 
 		if (!dev->txpos)
-			dev->txfcs = crc_ccitt(0, buf + 1, 2);
+			dev->txfcs = crc_ccitt(FCS_INIT, buf + 1, 2);
 
 		txlen = write_chunk(dev, buf + dev->txpos, 3 - dev->txpos);
 		if (txlen <= 0) {
@@ -303,7 +305,7 @@ static void mctp_serial_push_header(struct mctp_serial *dev, unsigned char c)
 	case 1:
 		if (c == MCTP_SERIAL_VERSION) {
 			dev->rxpos++;
-			dev->rxfcs = crc_ccitt_byte(0, c);
+			dev->rxfcs = crc_ccitt_byte(FCS_INIT, c);
 		} else {
 			dev->rxstate = STATE_ERR;
 		}



[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