]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
misc: xilinx-sdfec: Add ADD_LDPC_CODE protection
authorDerek Kiernan <derek.kiernan@xilinx.com>
Fri, 28 Sep 2018 11:06:18 +0000 (12:06 +0100)
committerMichal Simek <michal.simek@xilinx.com>
Mon, 1 Oct 2018 13:01:54 +0000 (15:01 +0200)
For the ioctl ADD_LDPC_CODE_PARAMS increase the protection to ensure
codes cannot be added when the device has started.

Signed-off-by: Derek Kiernan <derek.kiernan@xilinx.com>
Signed-off-by: Mauro DeLuca <mauro.de-luca@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/misc/xilinx_sdfec.c

index 34ee5db8bc25ecfd49d553638f3e9700be59d49f..88acffb7d5d0b791d687d9734e8cd400bcfe61f3 100644 (file)
@@ -734,6 +734,15 @@ xsdfec_add_ldpc(struct xsdfec_dev *xsdfec, void __user *arg)
                        __func__, xsdfec->config.fec_id);
                goto err_out;
        }
+
+       /* Verify Device has not started */
+       if (xsdfec->state == XSDFEC_STARTED) {
+               dev_err(xsdfec->dev,
+                       "%s attempting to write LDPC code while started for SDFEC%d",
+                       __func__, xsdfec->config.fec_id);
+               return -EIO;
+       }
+
        /* Disable Write Protection before proceeding */
        if (xsdfec->wr_protect)
                xsdfec_wr_protect(xsdfec, false);