crypto: qat - ratelimit invalid ioctl message and print the invalid cmd
authorColin Ian King <colin.king@canonical.com>
Tue, 22 Jun 2021 15:16:08 +0000 (16:16 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Mon, 28 Jun 2021 03:28:08 +0000 (11:28 +0800)
Currently incorrect QAT ioctls can spam the kernel log with error messages
of the form "QAT: Invalid ioctl" if a userspace program uses the wrong
ioctl command. Quench the messages by ratelimiting them and also print
the invalid command being used as that is useful to know.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Giovanni Cabiddu <giovanni.cabiddu@intel.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/qat/qat_common/adf_ctl_drv.c

index 96b437b..6f64aa6 100644 (file)
@@ -406,7 +406,7 @@ static long adf_ctl_ioctl(struct file *fp, unsigned int cmd, unsigned long arg)
                ret = adf_ctl_ioctl_get_status(fp, cmd, arg);
                break;
        default:
-               pr_err("QAT: Invalid ioctl\n");
+               pr_err_ratelimited("QAT: Invalid ioctl %d\n", cmd);
                ret = -EFAULT;
                break;
        }