public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Fritz <chf.fritz@googlemail.com>
To: kernel-janitors@vger.kernel.org
Subject: [PATCH] usb: gadget: f_mass_storage: common->curlun could be NULL
Date: Tue, 29 Nov 2011 21:00:16 +0000	[thread overview]
Message-ID: <1322600416.2182.48.camel@mars> (raw)

This patch adds a NULL check for common->curlun in case of an unknown_cmnd
in do_scsi_command(). 

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
---
 drivers/usb/gadget/f_mass_storage.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c
index c39d588..0e42027 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2184,7 +2184,8 @@ unknown_cmnd:
 		reply = check_command(common, common->cmnd_size,
 				      DATA_DIR_UNKNOWN, 0xff, 0, unknown);
 		if (reply = 0) {
-			common->curlun->sense_data = SS_INVALID_COMMAND;
+			if (common->curlun)
+				common->curlun->sense_data = SS_INVALID_COMMAND;
 			reply = -EINVAL;
 		}
 		break;
-- 
1.7.2.5



             reply	other threads:[~2011-11-29 21:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-29 21:00 Christoph Fritz [this message]
2011-11-30 13:08 ` [PATCH] usb: gadget: f_mass_storage: common->curlun could be NULL Michal Nazarewicz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1322600416.2182.48.camel@mars \
    --to=chf.fritz@googlemail.com \
    --cc=kernel-janitors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox