浏览代码

usb: chipidea: debug: check before accessing ci_role

ci_role BUGs when the role is >= CI_ROLE_END.

Cc: stable@vger.kernel.org  #v3.10+
Signed-off-by: Michael Thalmeier <michael.thalmeier@hale.at>
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Michael Thalmeier 8 年之前
父节点
当前提交
0340ff83cd
共有 1 个文件被更改,包括 2 次插入1 次删除
  1. 2 1
      drivers/usb/chipidea/debug.c

+ 2 - 1
drivers/usb/chipidea/debug.c

@@ -294,7 +294,8 @@ static int ci_role_show(struct seq_file *s, void *data)
 {
 {
 	struct ci_hdrc *ci = s->private;
 	struct ci_hdrc *ci = s->private;
 
 
-	seq_printf(s, "%s\n", ci_role(ci)->name);
+	if (ci->role != CI_ROLE_END)
+		seq_printf(s, "%s\n", ci_role(ci)->name);
 
 
 	return 0;
 	return 0;
 }
 }