public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch 2/2] staging: rtl8192e: don't just print an error and continue
@ 2015-07-28 15:49 Dan Carpenter
  0 siblings, 0 replies; only message in thread
From: Dan Carpenter @ 2015-07-28 15:49 UTC (permalink / raw)
  To: kernel-janitors

I was looking at how TOTAL_CAM_ENTRY is used and I saw this code.  We
print an error but continue writing "EntryNo" to a register as if it
were valid.  "EntryNo" is controlled by the user in rtl8192_ioctl() so
it definitely can be invalid.  I'm not positive what happens with the
invalid data but it can't be good.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
index c146b7e..29dd93a 100644
--- a/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
+++ b/drivers/staging/rtl8192e/rtl8192e/rtl_cam.c
@@ -117,8 +117,10 @@ void rtl92e_set_key(struct net_device *dev, u8 EntryNo, u8 KeyIndex,
 		}
 	}
 	priv->rtllib->is_set_key = true;
-	if (EntryNo >= TOTAL_CAM_ENTRY)
+	if (EntryNo >= TOTAL_CAM_ENTRY) {
 		netdev_info(dev, "%s(): Invalid CAM entry\n", __func__);
+		return;
+	}
 
 	RT_TRACE(COMP_SEC,
 		 "==>to rtl92e_set_key(), dev:%p, EntryNo:%d, KeyIndex:%d,KeyType:%d, MacAddr %pM\n",

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2015-07-28 15:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-28 15:49 [patch 2/2] staging: rtl8192e: don't just print an error and continue Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox