Save the string address before pass to strsep, release it at end.
Because strsep will update the string address to point after the
token.
Fixes: c31dc9fe165d("crypto: hisilicon/qm - add DebugFS for xQC and...")
Signed-off-by: Sihang Chen <chensihang1@hisilicon.com>
Signed-off-by: Yang Shen <shenyang39@huawei.com>
Reviewed-by: Zhou Wang <wangzhou1@hisilicon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
 static int qm_cmd_write_dump(struct hisi_qm *qm, const char *cmd_buf)
 {
        struct device *dev = &qm->pdev->dev;
-       char *presult, *s;
+       char *presult, *s, *s_tmp;
        int ret;
 
        s = kstrdup(cmd_buf, GFP_KERNEL);
        if (!s)
                return -ENOMEM;
 
+       s_tmp = s;
        presult = strsep(&s, " ");
        if (!presult) {
-               kfree(s);
-               return -EINVAL;
+               ret = -EINVAL;
+               goto err_buffer_free;
        }
 
        if (!strcmp(presult, "sqc"))
        if (ret)
                dev_info(dev, "Please echo help\n");
 
-       kfree(s);
+err_buffer_free:
+       kfree(s_tmp);
 
        return ret;
 }